瀏覽代碼

修改搜索新闻

15313670163 1 月之前
父節點
當前提交
14b1f6daea
共有 1 個文件被更改,包括 4 次插入5 次删除
  1. 4 5
      app/JsonRpc/NewsService.php

+ 4 - 5
app/JsonRpc/NewsService.php

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