Преглед на файлове

修改获取所有皮肤、验证关键词的接口

FengR преди 2 месеца
родител
ревизия
12c1be589a
променени са 1 файла, в които са добавени 13 реда и са изтрити 11 реда
  1. 13 11
      app/JsonRpc/PublicRpcService.php

+ 13 - 11
app/JsonRpc/PublicRpcService.php

@@ -1019,7 +1019,7 @@ class PublicRpcService implements PublicRpcServiceInterface
         $latestUpdate = null;
         foreach ($result['template'] as $key => $value) {
             $templateImg = json_decode($value['template_img'], true);
-            $result['template'][$key]['template_img'] = $templateImg[0];
+            $result['template'][$key]['template_img'] = $templateImg;
             // 更新最新时间:取最大的 updated_at
             if ($latestUpdate === null || $value['updated_at'] > $latestUpdate) {
                 $latestUpdate = $value['updated_at'];
@@ -4373,36 +4373,38 @@ class PublicRpcService implements PublicRpcServiceInterface
      */
     public function checkRepeatKeyword(array $data): array
     {
-        $keyword = json_decode($data['keyword'],true);
-        if(empty($keyword)){
+        
+        if(empty($data['keyword'])){
             return Result::error('关键词不能为空!');
         }
+        $keyword = explode(',',$data['keyword']);
         // $keyword_list = array_column($keyword,'keyword');
         if(count($keyword) != count(array_unique($keyword))){
             return Result::error('关键词不能重复!');
         }
+        $keyword = '['.$data['keyword'].']';
         if($data['type'] == 'style'){
             $template_class_keyword = TemplateClass::pluck('keyword')->toArray();
-            if(in_array($data['keyword'],$template_class_keyword)){
-                return Result::error('关键词不能与风格关键词重复!');
+            if(in_array($keyword,$template_class_keyword)){
+                return Result::error('此风格关键词已存在!');
             }
         }
         if($data['type'] == 'skin'){
             $template_keyword = Template::pluck('template_keyword')->toArray();
-            if(in_array($data['keyword'],$template_keyword)){
-                return Result::error('关键词不能与皮肤关键词重复!');
+            if(in_array($keyword,$template_keyword)){
+                return Result::error('此皮肤关键词已存在!');
             }
         }
         if($data['type'] == 'sector'){
             $sector_keyword = Sector::where('template_id',$data['template_id'])->pluck('sector_keyword')->toArray();
-            if(in_array($data['keyword'],$sector_keyword)){
-                return Result::error('关键词不能与通栏关键词重复!');
+            if(in_array($keyword,$sector_keyword)){
+                return Result::error('此通栏关键词已存在!');
             }
         }
         if($data['type'] == 'component'){
             $component_keyword = Component::pluck('component_keyword')->toArray();
-            if(in_array($data['keyword'],$component_keyword)){
-                return Result::error('关键词不能与组件关键词重复!');
+            if(in_array($keyword,$component_keyword)){
+                return Result::error('此组件关键词已存在!');
             }
         }