LiuJ 1 deň pred
rodič
commit
f7f30ca4d1
1 zmenil súbory, kde vykonal 22 pridanie a 7 odobranie
  1. 22 7
      app/JsonRpc/ClientService.php

+ 22 - 7
app/JsonRpc/ClientService.php

@@ -170,9 +170,13 @@ class ClientService implements ClientServiceInterface
                             var_dump($cat_1st_arr, '-----------1-------2');
                             // 第一次查询:imgurl 不为空的数据
                             if ($imgSize > 0) {
-                                $imgArticles = Db::table('article')->leftJoin('article_ignore', function ($join) use ($website_id) {
-                                    $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
-                                })->whereNull('article_ignore.article_id')->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))->where('status', 1)->whereNotNull('imgurl')->where('imgurl', '!=', '')->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                $imgArticles = Db::table('article')
+                                    ->leftJoin('article_ignore', function ($join) use ($website_id) {
+                                        $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
+                                    })->whereNull('article_ignore.article_id')->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))->where('status', 1)
+
+
+                                    ->whereNotNull('imgurl')->where('imgurl', '!=', '')->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
                                 //拼接上拼音
                                 foreach ($imgArticles as $k => $v) {
                                     $imgArticles[$k]->pinyin = $catiall[$v->catid][0];
@@ -181,7 +185,12 @@ class ClientService implements ClientServiceInterface
 
                             // 第二次查询:imgurl 为空的数据
                             if ($textSize > 0) {
-                                $textArticles = Db::table('article')->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))->where('status', 1)->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                $textArticles = Db::table('article')
+                                    ->leftJoin('article_ignore', function ($join) use ($website_id) {
+                                        $join->on('article.id', '=', 'article_ignore.article_id')->where('article_ignore.website_id', '=', $website_id);
+                                    })->whereNull('article_ignore.article_id')->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))->where('status', 1)
+
+                                    ->where('status', 1)->limit($textSize)->orderBy('updated_at', 'desc')->get()->toArray();
                                 //拼接上拼音
                                 foreach ($textArticles as $k => $v) {
                                     $textArticles[$k]->pinyin = $catiall[$v->catid][0];
@@ -194,7 +203,9 @@ class ClientService implements ClientServiceInterface
                             //取出所有的子级的imgurl 不为空的数据
                             if ($imgSize > 0) {
 
-                                $imgArticles = Db::table('article')->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])->where('status', 1)->whereIn('catid', $categoryIds)->whereNotNull('imgurl')->where('imgurl', '!=', '')->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                $imgArticles = Db::table('article')
+
+                                    ->whereRaw('MATCH(level_text) AGAINST(? IN NATURAL LANGUAGE MODE)', [$level])->where('status', 1)->whereIn('catid', $categoryIds)->whereNotNull('imgurl')->where('imgurl', '!=', '')->limit($imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
                                 //拼接上拼音
                                 foreach ($imgArticles as $k => $v) {
                                     $imgArticles[$k]->pinyin = $catiall[$v->catid][0] ?? '=====';
@@ -220,13 +231,17 @@ class ClientService implements ClientServiceInterface
                         if ($child_id > 0) {
                             //取出子级的imgurl 不为空的数据
                             if ($child_imgSize > 0) {
-                                $child_imgArticles = Db::table('article')->where('catid', $child_id)->whereNotNull('imgurl')->limit($child_imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                $child_imgArticles = Db::table('article')->where('catid', $child_id)
+                                    ->where('status', 1)
+                                    ->whereNotNull('imgurl')->limit($child_imgSize)->orderBy('updated_at', 'desc')->get()->toArray();
                             } else {
                                 $child_imgArticles =  [];
                             }
                             //取出子级的imgurl 为空的数据
                             if ($child_textSize > 0) {
-                                $child_textArticles = Db::table('article')->where('catid', $child_id)->whereNull('imgurl')->limit($child_textSize)->orderBy('updated_at', 'desc')->get()->toArray();
+                                $child_textArticles = Db::table('article')
+                                    ->where('status', 1)
+                                    ->where('catid', $child_id)->whereNull('imgurl')->limit($child_textSize)->orderBy('updated_at', 'desc')->get()->toArray();
                             } else {
                                 $child_textArticles = [];
                             }