Sfoglia il codice sorgente

修改 获取通栏列表

15313670163 3 giorni fa
parent
commit
8ee56245bf
1 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 5 3
      app/JsonRpc/PublicRpcService.php

+ 5 - 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.class_id'] = $data['template_class_id'];
+            $where['template_class.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,17 +980,19 @@ class PublicRpcService implements PublicRpcServiceInterface
         }else{
             $size_id = [];
         }
-        // $size_id = $size_id->toArray();
         $result = Sector::where($where)
             ->when(!empty($size_id), function ($query) use ($size_id) {
                 $query->whereIn('size_id', $size_id);
             })
             ->leftJoin('size', 'size.id', '=', 'sector.size_id')
-            ->leftJoin('template_class', 'template_class.class_id', '=', 'sector.template_class_id')
             ->leftJoin('template', 'template.template_id', '=', 'sector.template_id')
+            ->leftJoin('template_class', 'template_class.class_id', '=', 'template.template_class_id') 
             ->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)){
+            return Result::error('暂无通栏!');
+        }
         return Result::success($result);
     }
     /**