Browse Source

修改 获取通栏列表

15313670163 3 ngày trước cách đây
mục cha
commit
4b8e12b0eb
1 tập tin đã thay đổi với 4 bổ sung3 xóa
  1. 4 3
      app/JsonRpc/PublicRpcService.php

+ 4 - 3
app/JsonRpc/PublicRpcService.php

@@ -963,7 +963,7 @@ class PublicRpcService implements PublicRpcServiceInterface
     {
         $where = [];
         if (isset($data['template_class_id']) && !empty($data['template_class_id'])) {
-            $where['template_class.template_class_id'] = $data['template_class_id'];
+            $where['template.template_class_id'] = $data['template_class_id'];
         }
         if (isset($data['template_id']) && !empty($data['template_id'])) {
             array_push($where, ['template.template_id', $data['template_id']]);
@@ -980,14 +980,15 @@ class PublicRpcService implements PublicRpcServiceInterface
         }else{
             $size_id = [];
         }
-        $result = Sector::where($where)
-            ->when(!empty($size_id), function ($query) use ($size_id) {
+        $result = Sector::when(!empty($size_id), function ($query) use ($size_id) {
                 $query->whereIn('size_id', $size_id);
             })
             ->leftJoin('size', 'size.id', '=', 'sector.size_id')
             ->leftJoin('template', 'template.template_id', '=', 'sector.template_id')
             ->leftJoin('template_class', 'template_class.class_id', '=', 'template.template_class_id') 
+            ->where($where)
             ->select('sector.*', 'size.width','size.height','template_class.name as class_name','template.template_name')
+            
             ->orderBy('sector.id', 'desc')
             ->paginate($data['page_size'], ['*'], 'page', $data['page']);
         if(empty($result)){