Selaa lähdekoodia

修改接口: 获取通栏详情

15313670163 1 päivä sitten
vanhempi
sitoutus
fc4fa489d3
1 muutettua tiedostoa jossa 23 lisäystä ja 3 poistoa
  1. 23 3
      app/JsonRpc/PublicRpcService.php

+ 23 - 3
app/JsonRpc/PublicRpcService.php

@@ -1043,13 +1043,33 @@ class PublicRpcService implements PublicRpcServiceInterface
 
     public function getSectorInfo(array $data): array
     {
-        $where = [];
+        // $where = [];
         $where[] = ['sector.id', '=', $data['id']];
         $result = Sector::where($where)
-            ->leftJoin('size', 'size.id', '=', 'sector.size_id')
-            ->select('sector.*', 'size.width', 'size.height')
+            ->leftJoin('template', 'template.template_id', '=', 'sector.template_id')
+            ->select('sector.*','template.template_name','template.template_id')
             ->orderBy('sector.id', 'desc')
             ->first();
+         $result['component'] = SectorComponent::where('sector_component.sector_id', $data['id'])
+        ->leftJoin('component', 'component.component_type', '=', 'sector_component.component_id')
+        ->select('component.component_type','sector_component.sort_id','component.component_name')
+        ->get()->all();
+
+        // $sorts = array_values(array_unique(array_column($components, 'sort_id')));
+        // $result['component'] = $components;
+        // $result['place'] = SectorPlace::where('sector_place.sector_type', $result['place_type'])
+        // ->select('sector_place.*')
+        // ->get()->all();
+        // $key_num = 0;
+        // foreach($result['place'] as $key => $value){
+        //     if($value['type_id'] == 1){
+        //         $sector_place['sector_plate'] = $value;
+        //     }else{
+        //         $sector_place['component_place'][$key_num] = $value;
+        //         $key_num++;
+        //     }
+        // }
+        // $result['place'] = $sector_place;
         if (empty($result)) {
             return Result::error('此通栏不存在!');
         }