Преглед изворни кода

Merge branch '20250522_diywebfr'

15313670163 пре 1 дан
родитељ
комит
cfa51d94c8
1 измењених фајлова са 12 додато и 3 уклоњено
  1. 12 3
      app/JsonRpc/PublicRpcService.php

+ 12 - 3
app/JsonRpc/PublicRpcService.php

@@ -2598,12 +2598,12 @@ class PublicRpcService implements PublicRpcServiceInterface
         ->leftJoin('component','component_img.component_id','=','component.component_type')
         ->select('component_img.*','template.template_name','component.component_name')
         ->paginate($data['page_size'], ['*'], 'page', $data['page']);
-        if(empty($component_img)){
+        if($component_img->isEmpty()){
             return Result::error('组件预览图不存在!');
         }
         $component_img = [
-            'data' => $component_img,
-            'total' => $component_img['total'],
+            'data' => $component_img->items(),
+            'total' => $component_img->total(),
         ];
         return Result::success($component_img);
     }
@@ -2617,6 +2617,10 @@ class PublicRpcService implements PublicRpcServiceInterface
         if(!empty($img)){
             return Result::error('该组件已存在此皮肤的预览图!');
         }
+        $component = ComponentImg::where('component_id',$data['component_id'])->where('img_id',$data['img_id'])->first();
+        if(!empty($component)){
+            return Result::error('组件预览图编号已存在!');
+        }
         $component_img = ComponentImg::insertGetId($data);
         if(empty($component_img)){
             return Result::error('添加失败!');
@@ -2643,6 +2647,11 @@ class PublicRpcService implements PublicRpcServiceInterface
         if(!empty($img)){
             return Result::error('该组件已存在此皮肤的预览图!');
         }
+        $component = ComponentImg::where('component_id',$data['component_id'])->where('id','!=',$data['id'])->where('img_id',$data['img_id'])->first();
+
+        if(!empty($component)){
+            return Result::error('组件预览图编号已存在!');
+        }
         unset($data['user_id']);
         // unset($data['updated_at']);
         $id = $data['id'];