Jelajahi Sumber

Merge branch '20250814_randomweb_fr'

FengR 2 bulan lalu
induk
melakukan
c62256cc97
1 mengubah file dengan 9 tambahan dan 4 penghapusan
  1. 9 4
      app/JsonRpc/PublicRpcService.php

+ 9 - 4
app/JsonRpc/PublicRpcService.php

@@ -4454,27 +4454,32 @@ class PublicRpcService implements PublicRpcServiceInterface
      */
      */
     public function checkRepeatKeyword(array $data): array
     public function checkRepeatKeyword(array $data): array
     {
     {
-        
         if(empty($data['keyword'])){
         if(empty($data['keyword'])){
             return Result::error('关键词不能为空!');
             return Result::error('关键词不能为空!');
         }
         }
-        $keyword = explode(',',$data['keyword']);
+        $keyword = json_decode($data['keyword'],true);
+        $keyword = array_map('trim', $keyword);
         // $keyword_list = array_column($keyword,'keyword');
         // $keyword_list = array_column($keyword,'keyword');
         if(count($keyword) != count(array_unique($keyword))){
         if(count($keyword) != count(array_unique($keyword))){
             return Result::error('关键词不能重复!');
             return Result::error('关键词不能重复!');
         }
         }
-        $keyword = '['.$data['keyword'].']';
+        // return Result::success(json_encode($keyword,JSON_UNESCAPED_UNICODE));
+        $keyword = json_encode($keyword, JSON_UNESCAPED_UNICODE);
+        
         if($data['type'] == 'style'){
         if($data['type'] == 'style'){
             $template_class_keyword = TemplateClass::pluck('keyword')->toArray();
             $template_class_keyword = TemplateClass::pluck('keyword')->toArray();
+            $keyword = preg_replace('/,/', ', ', $keyword);
             if(in_array($keyword,$template_class_keyword)){
             if(in_array($keyword,$template_class_keyword)){
                 return Result::error('此风格关键词已存在!');
                 return Result::error('此风格关键词已存在!');
             }
             }
         }
         }
         if($data['type'] == 'skin'){
         if($data['type'] == 'skin'){
             $template_keyword = Template::pluck('template_keyword')->toArray();
             $template_keyword = Template::pluck('template_keyword')->toArray();
+            $keyword = preg_replace('/,/', ', ', $keyword);
             if(in_array($keyword,$template_keyword)){
             if(in_array($keyword,$template_keyword)){
                 return Result::error('此皮肤关键词已存在!');
                 return Result::error('此皮肤关键词已存在!');
             }
             }
+            return Result::success(['关键词'=>$keyword,'type'=>$template_keyword]);
         }
         }
         if($data['type'] == 'sector'){
         if($data['type'] == 'sector'){
             $sector_keyword = Sector::where('template_id',$data['template_id'])->pluck('sector_keyword')->toArray();
             $sector_keyword = Sector::where('template_id',$data['template_id'])->pluck('sector_keyword')->toArray();
@@ -4490,7 +4495,7 @@ class PublicRpcService implements PublicRpcServiceInterface
         }
         }
         
         
         
         
-        return Result::success($data);
+        return Result::success(['验证通过']);
     }
     }
     /**
     /**
      * 自助建站-验证网站模板相关类型
      * 自助建站-验证网站模板相关类型