LiuJ 23 tuntia sitten
vanhempi
sitoutus
464333855d
1 muutettua tiedostoa jossa 17 lisäystä ja 3 poistoa
  1. 17 3
      app/JsonRpc/ClientService.php

+ 17 - 3
app/JsonRpc/ClientService.php

@@ -92,8 +92,11 @@ class ClientService implements ClientServiceInterface
             $websiteInfoIndexed[$value->category_id]->pinyin = $pinyin_str;
             // 算出一级  并且算出子级
             if ($value->pid == 0) {
-                $cat_1st_arr[$value->category_id] = [];
+                // $cat_1st_arr[$value->category_id] = [];
             } else {
+                if ($value->pid == 11) {
+                    var_dump($value->category_id, 'value->category_id');
+                }
                 $cat_1st_arr[$value->pid][] = $value->category_id;
             }
         }
@@ -114,7 +117,7 @@ class ClientService implements ClientServiceInterface
         // aboutArticle = 底部导航详情页
         // return $cat_1st_arr;
         // return $cat_1st_arr;
-        // var_dump($cat_1st_arr, 'cat_1st_arr');//一级所有子级的记录
+        var_dump($cat_1st_arr[11], 'cat_1st_arr'); //一级所有子级的记录
         // var_dump($catiall, 'catiall');//拼音
         $templateData = [];
         switch ($getpage) {
@@ -147,10 +150,19 @@ class ClientService implements ClientServiceInterface
                     if ($category_id > 0) {
                         // 第一次查询:imgurl 不为空的数据
                         $imgArticles = Db::table('article')
+                            ->leftJoin('article_ignore', function ($join) use ($wetbsite_id) {
+                                $join->on('article.id', '=', 'article_ignore.article_id')
+                                    ->where('article_ignore.website_id', '=', $wetbsite_id);
+                            })
+                            ->whereNull('article_ignore.article_id')
                             // ->whereIn('catid', [$category_id])
                             ->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))
                             ->where('status', 1)
                             ->whereNotNull('imgurl')
+
+                            // ignore_ids  是空 或者[],或者不存在website_id的数据  json
+                            // ->where('ignore_ids', 'not like', '%' . $wetbsite_id . '%')
+                            ->where('imgurl', '!=', '')
                             ->limit($imgSize)
                             ->orderBy('updated_at', 'desc')
                             ->get()
@@ -165,7 +177,8 @@ class ClientService implements ClientServiceInterface
                             // ->whereIn('catid', [$category_id])
                             ->whereIn('catid', $temp_arr = array_merge([$category_id], $cat_1st_arr[$category_id]))
                             ->where('status', 1)
-                            ->whereNull('imgurl')
+                            // ->where('ignore_ids', 'not like', '%' . $wetbsite_id . '%')
+                            // ->whereNull('imgurl')
                             ->limit($textSize)
                             ->orderBy('updated_at', 'desc')
                             ->get()
@@ -186,6 +199,7 @@ class ClientService implements ClientServiceInterface
                             ->where('status', 1)
                             ->whereIn('catid', $categoryIds)
                             ->whereNotNull('imgurl')
+                            ->where('imgurl', '!=', '')
                             ->limit($imgSize)
                             ->orderBy('updated_at', 'desc')
                             ->get()