Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
eb48ca58
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
eb48ca58
编写于
3月 30, 2019
作者:
G
gongfuxiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
应用数据,商品大分类数据缓存
上级
f9620b93
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
41 addition
and
11 deletion
+41
-11
application/service/GoodsService.php
application/service/GoodsService.php
+19
-0
application/service/PluginsService.php
application/service/PluginsService.php
+22
-11
未找到文件。
application/service/GoodsService.php
浏览文件 @
eb48ca58
...
...
@@ -56,6 +56,15 @@ class GoodsService
*/
public
static
function
GoodsCategory
(
$params
=
[])
{
// 从缓存获取
$key
=
'cache_goods_category_key_data'
;
$data
=
cache
(
$key
);
if
(
!
empty
(
$data
))
{
return
$data
;
}
// 获取分类
$where
=
empty
(
$params
[
'where'
])
?
[
'pid'
=>
0
,
'is_enable'
=>
1
]
:
$params
[
'where'
];
$data
=
self
::
GoodsCategoryList
(
$where
);
if
(
!
empty
(
$data
))
...
...
@@ -83,6 +92,10 @@ class GoodsService
}
}
}
// 存储缓存
cache
(
$key
,
$data
);
return
$data
;
}
...
...
@@ -2066,6 +2079,9 @@ class GoodsService
$data
[
'upd_time'
]
=
time
();
if
(
Db
::
name
(
'GoodsCategory'
)
->
where
([
'id'
=>
intval
(
$params
[
'id'
])])
->
update
(
$data
))
{
// 删除大分类缓存
cache
(
'cache_goods_category_key_data'
,
null
);
return
DataReturn
(
'编辑成功'
,
0
);
}
return
DataReturn
(
'编辑失败'
,
-
100
);
...
...
@@ -2108,6 +2124,9 @@ class GoodsService
// 开始删除
if
(
Db
::
name
(
'GoodsCategory'
)
->
where
([
'id'
=>
$ids
])
->
delete
())
{
// 删除大分类缓存
cache
(
'cache_goods_category_key_data'
,
null
);
return
DataReturn
(
'删除成功'
,
0
);
}
return
DataReturn
(
'删除失败'
,
-
100
);
...
...
application/service/PluginsService.php
浏览文件 @
eb48ca58
...
...
@@ -34,23 +34,31 @@ class PluginsService
*/
public
static
function
PluginsData
(
$plugins
,
$attachment_field
=
[])
{
// 获取数据
$data
=
Db
::
name
(
'Plugins'
)
->
where
([
'plugins'
=>
$plugins
])
->
value
(
'data'
);
if
(
!
empty
(
$data
))
//
从缓存
获取数据
$data
=
cache
(
'cache_plugins_data_key_'
.
$plugins
);
if
(
empty
(
$data
))
{
$data
=
json_decode
(
$data
,
true
);
// 是否有图片需要处理
if
(
!
empty
(
$attachment_field
)
&&
is_array
(
$attachment_field
))
// 获取数据
$data
=
Db
::
name
(
'Plugins'
)
->
where
([
'plugins'
=>
$plugins
])
->
value
(
'data'
);
if
(
!
empty
(
$data
))
{
foreach
(
$attachment_field
as
$field
)
$data
=
json_decode
(
$data
,
true
);
// 是否有图片需要处理
if
(
!
empty
(
$attachment_field
)
&&
is_array
(
$attachment_field
))
{
if
(
isset
(
$data
[
$field
])
)
foreach
(
$attachment_field
as
$field
)
{
$data
[
$field
.
'_old'
]
=
$data
[
$field
];
$data
[
$field
]
=
ResourcesService
::
AttachmentPathViewHandle
(
$data
[
$field
]);
if
(
isset
(
$data
[
$field
]))
{
$data
[
$field
.
'_old'
]
=
$data
[
$field
];
$data
[
$field
]
=
ResourcesService
::
AttachmentPathViewHandle
(
$data
[
$field
]);
}
}
}
// 存储缓存
cache
(
'cache_plugins_data_key_'
.
$plugins
,
$data
);
}
}
return
DataReturn
(
'处理成功'
,
0
,
$data
);
...
...
@@ -104,6 +112,9 @@ class PluginsService
// 数据更新
if
(
Db
::
name
(
'Plugins'
)
->
where
([
'plugins'
=>
$params
[
'plugins'
]])
->
update
([
'data'
=>
json_encode
(
$params
[
'data'
]),
'upd_time'
=>
time
()]))
{
// 删除缓存
cache
(
'plugins_data_key_'
.
$params
[
'plugins'
],
null
);
return
DataReturn
(
'操作成功'
);
}
return
DataReturn
(
'操作失败'
,
-
100
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录