Explorar o código

模板一旦发布删掉缓存

durong %!s(int64=5) %!d(string=hai) anos
pai
achega
e9282ac3eb

+ 5 - 0
app/Repositories/CmsContentTemplateSetRepository.php

@@ -354,6 +354,7 @@ class CmsContentTemplateSetRepository
     {
         $group_key = config('constants.CMS_GROUP');
         $market_key = config('constants.CMS_MARKET');
+        $exchange_key = config('constants.CMS_EXCHANGE');
 
         //同一个城市同一个模板(团购/菜市场) 只能有一种状态(草稿/发布),已发布的一旦被编辑把之前的直接删掉
         $template = $this->cmsContentTemplate->select('id', 'city_name', 'city_id', 'title', 'apply_type', 'is_open', 'status')->where('id', $request['tpl_id'])->first();
@@ -418,6 +419,10 @@ class CmsContentTemplateSetRepository
             if (Cache::has($market_key)) {
                 Cache::forget($market_key);
             }
+        } elseif ($template->apply_type == 2) {
+            if (Cache::has($exchange_key)) {
+                Cache::forget($exchange_key);
+            }
         }
 
     }

+ 1 - 0
config/constants.php

@@ -7,4 +7,5 @@
 return [
     'CMS_GROUP' => env('REDIS_CMS_GROUP_KEY', 'cms_shop_group'),
     'CMS_MARKET' => env('REDIS_CMS_MARKET_KEY', 'cms_shop_market'),
+    'CMS_EXCHANGE' => env('REDIS_CMS_EXCHANGE_KEY', 'cms_shop_exchange'),
 ];