Эх сурвалжийг харах

修改接口:组件管理-获取组件类型

15313670163 2 өдөр өмнө
parent
commit
fafb66d33a

+ 9 - 3
app/JsonRpc/PublicRpcService.php

@@ -2106,12 +2106,18 @@ class PublicRpcService implements PublicRpcServiceInterface
         if(isset($data['id']) && !empty($data['id'])){
             $where['id'] = $data['id'];
         }
-        $component_type = ComponentType::where($where)->first();
+        $component_type = ComponentType::where($where)->get()->all();
         if(empty($component_type)){
             return Result::error('组件类型不存在!');
         }
-        $all_code = json_decode($component_type['com_code'] ?? '',true);
-        $component_type['all_code'] = $all_code['listType'] ?? [];
+        if(count($component_type) == 1){
+            $all_code = json_decode($component_type[0]['com_code'] ?? '',true);
+            $component_type[0]['all_code'] = $all_code['listType'] ?? [];
+            $result = $component_type[0];
+        }else{
+            $result = $component_type;
+        }
+       
         if(empty($component_type)){
             return Result::error('组件类型不存在!');
         }