浏览代码

获取新闻列表

15313670163 3 月之前
父节点
当前提交
bd7c676ab1
共有 1 个文件被更改,包括 4 次插入0 次删除
  1. 4 0
      app/JsonRpc/NewsService.php

+ 4 - 0
app/JsonRpc/NewsService.php

@@ -401,6 +401,7 @@ class NewsService implements NewsServiceInterface
             }
         }
         // return Result::success($where);
+
         $rep = Article::where(function ($query) use ($where) {
             foreach ($where as $condition) {
                 if ($condition[1] === 'in') {
@@ -414,6 +415,7 @@ class NewsService implements NewsServiceInterface
         ->limit($data['pageSize'])
         ->offset(($data['page'] - 1) * $data['pageSize'])
         ->get();
+
         $count =  Article::where(function ($query) use ($where) {
             foreach ($where as $condition) {
                 if ($condition[1] === 'in') {
@@ -423,10 +425,12 @@ class NewsService implements NewsServiceInterface
                 }
             }
         })->count();
+
         $data = [
             'rows'=>$rep->toArray(),
             'count'=>$count
         ];
+        
         if(empty($rep)){
             return Result::error("没有信息数据");
         }