15313670163 1 сар өмнө
parent
commit
14b1f6daea

+ 4 - 5
app/JsonRpc/NewsService.php

@@ -385,24 +385,23 @@ class NewsService implements NewsServiceInterface
     public function getWebsiteArticleList(array $data): array
     {
 
-       $where[] = ['status', '=', 1];
-
+        $where[] = ['status', '=', 1];
        if(isset($data['keyword'])  && !empty($data['keyword'])){
             array_push($where,['article.title','like','%'.$data['keyword'].'%']);
         }
         if(isset($data['catid'])  && !empty($data['catid'])){
             if(is_array($data['catid'])){
                 $category = WebsiteCategory::where('website_id',$data['website_id'])->whereIn('category_id',$data['catid'])->pluck('category_id');
-                $where[] = ['catid', 'in', $data['catid']];
+                array_push($where,['catid', 'in', $data['catid']]);
             }else{
                 $category = WebsiteCategory::where('website_id',$data['website_id'])->where('category_id',$data['catid'])->pluck('category_id');
-                $where[] = ['catid', '=', $data['catid']];
+                array_push($where,['catid', '=', $data['catid']]);
             }
             if(empty($category)){
                return Result::error("此网站暂无此栏目",0); 
             }
         }
-        // return Result::success($category);
+        // return Result::success($where);
         $rep = Article::where(function ($query) use ($where) {
             foreach ($where as $condition) {
                 if ($condition[1] === 'in') {