Răsfoiți Sursa

模块新闻加强plus版

15313670163 3 săptămâni în urmă
părinte
comite
f48d7d4b29
1 a modificat fișierele cu 10 adăugiri și 5 ștergeri
  1. 10 5
      app/JsonRpc/NewsService.php

+ 10 - 5
app/JsonRpc/NewsService.php

@@ -898,7 +898,7 @@ class NewsService implements NewsServiceInterface
                 'website_id' => $input['website_id'],
             ];
             // 查询栏目名称
-            $category = WebsiteCategory::where('category_id', $parentCatId)->where($website)->first(['alias', 'category_id']);
+            $category = WebsiteCategory::where('category_id', $parentCatId)->where($website)->first(['alias', 'category_id','aLIas_pinyin']);
             if(empty($category)){
                 $imgArticles = [];
                 $textArticles = [];
@@ -921,17 +921,19 @@ class NewsService implements NewsServiceInterface
                 'alias' => $category ? $category->alias : null,
                 'category_id' => $parentCatId,
                 'imgnum' => $imgArticles,
-                'textnum' => $textArticles
+                'textnum' => $textArticles,
+                'pinyin' => $category->aLIas_pinyin ?? '',
             ];
 
             if (!empty($item['child']) && $item['child'] != "") {
                 // 查询第一个pid等于parent中第一个参数的category来获取child的category_id
-                $childCategory = WebsiteCategory::where('pid', $parentCatId)->where($website)->first();
+                $childCategory = WebsiteCategory::where('pid', $parentCatId)->where($website)->select('category_id','alias','aLIas_pinyin')->get()->all();
                 if ($childCategory) {
                     list($childCatId, $childImgNum, $childTextNum) = explode(',', $item['child']);
 
                     // 查询子栏目名称
-                    $childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)->first(['alias', 'category_id']);
+                    $childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)->first(['alias', 'category_id','aLIas_pinyin']);
+                    // $childAllCartegory = WebsiteCategory::where('pid', $childCatId)->where($website)->first(['category_id']);
                     if(empty($childCategoryInfo)){
                         $childImgArticles = [];
                         $childTextArticles = [];
@@ -954,9 +956,12 @@ class NewsService implements NewsServiceInterface
                     $resultItem['child'] = [
                         'alias' => $childCategoryInfo ? $childCategoryInfo->alias : null,
                         'category_id' => $childCatId,
+                        'all_childcat' => $childCategory,
                         'imgnum' => $childImgArticles,
-                        'textnum' => $childTextArticles
+                        'textnum' => $childTextArticles,
+                        'pinyin' => $childCategoryInfo->aLIas_pinyin?? '',
                     ];
+                    // $resultItem['pinyin'] = $childCategoryInfo->aLIas_pinyin ?? '';
                 }
             }