Explorar el Código

修改接口:获取单页推荐列表

FengR hace 1 mes
padre
commit
557332c368
Se han modificado 1 ficheros con 3 adiciones y 3 borrados
  1. 3 3
      app/JsonRpc/NewsService.php

+ 3 - 3
app/JsonRpc/NewsService.php

@@ -9831,7 +9831,7 @@ class NewsService implements NewsServiceInterface
       ];
       $category = WebsiteCategory::where($where)->pluck('category_id')->toArray();
       // var_dump($ids);
-      if (empty($ids)) {
+      if (empty($category)) {
         return Result::error("推荐单页不存在");
       }
     }
@@ -9841,7 +9841,7 @@ class NewsService implements NewsServiceInterface
       array_push($where, ['title', 'like', '%'.$data['title'].'%']);
     }
     $result = SinglePage::when(!empty($category) ,function ($query) use ($category){
-      $query->whereIn('id', $category);
+      $query->whereIn('catid', $category);
     })
     ->when(!empty($where), function ($query) use ($where) {
         $query->where($where);
@@ -9854,7 +9854,7 @@ class NewsService implements NewsServiceInterface
     ->orderBy('updated_at', 'desc')
     ->paginate($data['page_size'], ['*'], 'page', $data['page']);
     if(empty($result->items())){
-      return Result::error('推荐单页不存在');
+      return Result::error('推荐单页不存在!');
     }
     $result = [
       'rows' => $result->items(),