提交 ed9720a2 编写于 作者: G gongfuxiang

应用数据,商品大分类数据缓存

上级 eb48ca58
...@@ -57,7 +57,7 @@ class GoodsService ...@@ -57,7 +57,7 @@ class GoodsService
public static function GoodsCategory($params = []) public static function GoodsCategory($params = [])
{ {
// 从缓存获取 // 从缓存获取
$key = 'cache_goods_category_key_data'; $key = config('shopxo.cache_goods_category_key');
$data = cache($key); $data = cache($key);
if(!empty($data)) if(!empty($data))
{ {
...@@ -2080,7 +2080,7 @@ class GoodsService ...@@ -2080,7 +2080,7 @@ class GoodsService
if(Db::name('GoodsCategory')->where(['id'=>intval($params['id'])])->update($data)) if(Db::name('GoodsCategory')->where(['id'=>intval($params['id'])])->update($data))
{ {
// 删除大分类缓存 // 删除大分类缓存
cache('cache_goods_category_key_data', null); cache(config('shopxo.cache_goods_category_key'), null);
return DataReturn('编辑成功', 0); return DataReturn('编辑成功', 0);
} }
...@@ -2125,7 +2125,7 @@ class GoodsService ...@@ -2125,7 +2125,7 @@ class GoodsService
if(Db::name('GoodsCategory')->where(['id'=>$ids])->delete()) if(Db::name('GoodsCategory')->where(['id'=>$ids])->delete())
{ {
// 删除大分类缓存 // 删除大分类缓存
cache('cache_goods_category_key_data', null); cache(config('shopxo.cache_goods_category_key'), null);
return DataReturn('删除成功', 0); return DataReturn('删除成功', 0);
} }
......
...@@ -35,7 +35,8 @@ class PluginsService ...@@ -35,7 +35,8 @@ class PluginsService
public static function PluginsData($plugins, $attachment_field = []) public static function PluginsData($plugins, $attachment_field = [])
{ {
// 从缓存获取数据 // 从缓存获取数据
$data = cache('cache_plugins_data_key_'.$plugins); $key = config('shopxo.cache_plugins_data_key').$plugins;
$data = cache($key);
if(empty($data)) if(empty($data))
{ {
// 获取数据 // 获取数据
...@@ -58,7 +59,7 @@ class PluginsService ...@@ -58,7 +59,7 @@ class PluginsService
} }
// 存储缓存 // 存储缓存
cache('cache_plugins_data_key_'.$plugins, $data); cache($key, $data);
} }
} }
return DataReturn('处理成功', 0, $data); return DataReturn('处理成功', 0, $data);
...@@ -113,7 +114,7 @@ class PluginsService ...@@ -113,7 +114,7 @@ class PluginsService
if(Db::name('Plugins')->where(['plugins'=>$params['plugins']])->update(['data'=>json_encode($params['data']), 'upd_time'=>time()])) if(Db::name('Plugins')->where(['plugins'=>$params['plugins']])->update(['data'=>json_encode($params['data']), 'upd_time'=>time()]))
{ {
// 删除缓存 // 删除缓存
cache('plugins_data_key_'.$params['plugins'], null); cache(config('shopxo.cache_plugins_data_key').$params['plugins'], null);
return DataReturn('操作成功'); return DataReturn('操作成功');
} }
......
...@@ -30,6 +30,12 @@ return [ ...@@ -30,6 +30,12 @@ return [
// 前台顶部导航 // 前台顶部导航
'cache_common_home_nav_footer_key' => 'cache_common_home_nav_footer_data', 'cache_common_home_nav_footer_key' => 'cache_common_home_nav_footer_data',
// 商品大分类缓存
'cache_goods_category_key' => 'cache_goods_category_key_data',
// 应用数据缓存
'cache_plugins_data_key' => 'cache_plugins_data_key_data_',
// 附件host, 数据库图片地址以/static/...开头 // 附件host, 数据库图片地址以/static/...开头
'attachment_host' => defined('__MY_PUBLIC_URL__') ? substr(__MY_PUBLIC_URL__, 0, -1) : '', 'attachment_host' => defined('__MY_PUBLIC_URL__') ? substr(__MY_PUBLIC_URL__, 0, -1) : '',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册