seven 2 dni temu
rodzic
commit
0ca0d74622

+ 2 - 2
app/Http/Controllers/admin/GameplayRule.php

@@ -114,7 +114,7 @@ class GameplayRule extends Controller
         if (!$info) {
             return $this->error(0, '角色不存在');
         }
-
+        GameplayRuleService::clearCache($info->keywords);
         $info->delete();
 
         return $this->success([], '删除成功');
@@ -122,7 +122,7 @@ class GameplayRule extends Controller
 
     public function info()
     {
-        $keywords = request()->get('keywords', '');
+        $keywords = request()->get('keywords', '');
         $result = GameplayRuleService::getGameplayRules($keywords);
         return $this->success($result);
     }

+ 12 - 0
app/Services/GameplayRuleService.php

@@ -120,6 +120,7 @@ class GameplayRuleService extends BaseService
         
        
         if($result){
+            self::clearCache($params['keywords']);
            $msg['code'] = self::YES;
            $msg['msg'] = '设置成功';
         }else{
@@ -151,4 +152,15 @@ class GameplayRuleService extends BaseService
 
         return $rulesArray;
     }
+
+    /**
+     * @description: 清除缓存
+     * @param string $keywords
+     * @return void
+     */
+    public static function clearCache($keywords)
+    {
+        $cacheKey = self::CACHE_KEY . $keywords;
+        Cache::forget($cacheKey);
+    }
 }