瀏覽代碼

Merge branch 'web_sannong_fr'

15313670163 2 天之前
父節點
當前提交
272dd9b38d
共有 1 個文件被更改,包括 6 次插入4 次删除
  1. 6 4
      app/JsonRpc/NewsService.php

+ 6 - 4
app/JsonRpc/NewsService.php

@@ -6222,8 +6222,9 @@ class NewsService implements NewsServiceInterface
                 $category_id = $parts[0] ?? null;
                 $imgnum = $parts[1] ?? null;
                 $textnum = $parts[2] ?? null;
+                $category_arr = array_merge([$category_id], $cat_1st_arr[$category_id] ?? [0]);
                 if(!empty($textnum) && $textnum > 0){
-                    $text_num = Company::where('category_id', $category_id)
+                    $text_num = Company::whereIn('category_id', $category_arr)
                     ->where('website_id',$data['website_id'])
                     ->where('status',1)
                     ->select('company.id','company.title','company.description','company.updated_at',
@@ -6234,7 +6235,7 @@ class NewsService implements NewsServiceInterface
                 }
                 if(!empty($imgnum) && $imgnum > 0){
 
-                    $img_num = Company::where('category_id', $category_id)
+                    $img_num = Company::whereIn('category_id', $category_arr)
                     ->where('website_id',$data['website_id'])
                     ->where('status',1)
                     ->where('imgurl','!=', '')
@@ -6868,8 +6869,9 @@ class NewsService implements NewsServiceInterface
                     $category_ids = explode(',', $val['id'])[0];
                     $cat_imgnum = explode(',', $val['id'])[1] ?? null;
                     $cat_textnum = explode(',', $val['id'])[2] ?? null;
+                    $category_arr = array_merge([$category_ids], $cat_1st_arr[$category_ids] ?? [0]);
                     if(!empty($cat_textnum) && $cat_textnum > 0){
-                        $text_num = Project::where('category_id', $category_ids)
+                        $text_num = Project::whereIn('category_id', $category_arr)
                         ->where('website_id',$data['website_id'])
                         ->where('status',1)
                         ->select('project.id','project.title','project.description','project.updated_at',
@@ -6879,7 +6881,7 @@ class NewsService implements NewsServiceInterface
                         ->get()->all();
                     }
                     if(!empty($cat_imgnum) && $cat_imgnum > 0){
-                        $img_num = Project::where('category_id', $category_ids)
+                        $img_num = Project::whereIn('category_id', $category_arr)
                         ->where('website_id',$data['website_id'])
                         ->where('status',1)
                         ->where('imgurl','!=', '')