diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php index 0a6f2346f..455d11e02 100755 --- a/application/service/GoodsService.php +++ b/application/service/GoodsService.php @@ -57,7 +57,7 @@ class GoodsService public static function GoodsCategory($params = []) { // 从缓存获取 - $key = 'cache_goods_category_key_data'; + $key = config('shopxo.cache_goods_category_key'); $data = cache($key); if(!empty($data)) { @@ -2080,7 +2080,7 @@ class GoodsService 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); } @@ -2125,7 +2125,7 @@ class GoodsService 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); } diff --git a/application/service/PluginsService.php b/application/service/PluginsService.php index d209d270b..f2c0d9ad5 100755 --- a/application/service/PluginsService.php +++ b/application/service/PluginsService.php @@ -35,7 +35,8 @@ class PluginsService 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)) { // 获取数据 @@ -58,7 +59,7 @@ class PluginsService } // 存储缓存 - cache('cache_plugins_data_key_'.$plugins, $data); + cache($key, $data); } } return DataReturn('处理成功', 0, $data); @@ -113,7 +114,7 @@ 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); + cache(config('shopxo.cache_plugins_data_key').$params['plugins'], null); return DataReturn('操作成功'); } diff --git a/config/shopxo.php b/config/shopxo.php index 3912d471c..f3c75a2b5 100755 --- a/config/shopxo.php +++ b/config/shopxo.php @@ -30,6 +30,12 @@ return [ // 前台顶部导航 '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/...开头 'attachment_host' => defined('__MY_PUBLIC_URL__') ? substr(__MY_PUBLIC_URL__, 0, -1) : '',