소스 검색

栏目列表

rkljw 1 개월 전
부모
커밋
09e98a4ae7
1개의 변경된 파일3개의 추가작업 그리고 33개의 파일을 삭제
  1. 3 33
      app/JsonRpc/NewsService.php

+ 3 - 33
app/JsonRpc/NewsService.php

@@ -31,41 +31,11 @@ class NewsService implements NewsServiceInterface
      */
     public function getCategoryList(array $data): array
     {
-        $where = [];
-        if (isset($data['name']) && $data['name']) {
-            array_push($where, ['category.name', 'like', '%' . $data['name'] . '%']);
-        }
-        if (isset($data['department_id']) && $data['department_id']) {
-            array_push($where, ['category.department_id', '=', $data['department_id']]);
-        }
-        $city_id = '';
-        if (isset($data['city_id']) && $data['city_id']) {
-            $city_id = intval($data['city_id']);
-        }
-        $rep = Category::where($where)
-            ->when($city_id, function ($query) use ($city_id) {
-                if (isset($city_id) && $city_id) {
-                    $query->whereJsonContains("category.city_arr_id", $city_id);
-                }
-            })
-            ->leftJoin('district', 'category.city_id', 'district.id')
-            ->leftJoin('department', 'category.department_id', 'department.id')
-            ->leftJoin('category as c', 'category.pid', 'c.id')
-            ->select("category.*", "district.name as city_name", "department.name as department_name", "c.name as parent_name")
-            ->limit($data['pageSize'])->orderByDesc('category.updated_at')->offset(($data['page'] - 1) * $data['pageSize'])->get();
-        $count = Category::where($where)->when($city_id, function ($query) use ($city_id) {
-            if (isset($city_id) && $city_id) {
-                $query->whereJsonContains("category.city_arr_id", $city_id);
-            }
-        })->count();
-        $data = [
-            'rows' => $rep->toArray(),
-            'count' => $count,
-        ];
-        if (empty($rep->toArray())) {
+        $rep = Category::select("category.*")->orderBy('category.updated_at',"asc")->get();
+        if (empty($rep)) {
             return Result::error("没有导航池数据");
         }
-        return Result::success($data);
+        return Result::success($rep);
     }
     public function myCategoryList(array $data): array
     {