소스 검색

优化模块新闻加强plus版

15313670163 2 주 전
부모
커밋
7488661460
1개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 4
      app/JsonRpc/NewsService.php

+ 10 - 4
app/JsonRpc/NewsService.php

@@ -934,7 +934,9 @@ class NewsService implements NewsServiceInterface
                     'article.introduce',
                     'article.islink',
                     'article.linkurl',
-                    'article.copyfrom')
+                    'article.copyfrom',
+                    DB::raw("'$parent_pinyin' as pinyin") // 添加 pinyin 字段
+                )
                 ->orderBy('updated_at', 'desc')
                 ->limit($parentImgNum)
                 ->get()->all();
@@ -955,7 +957,8 @@ class NewsService implements NewsServiceInterface
                         'article.introduce',
                         'article.islink',
                         'article.linkurl',
-                        'article.copyfrom')
+                        'article.copyfrom',
+                         DB::raw("'$parent_pinyin' as pinyin"))
                     ->orderBy('updated_at', 'desc')
                     ->limit($parentTextNum)
                     ->get()->all();
@@ -980,6 +983,7 @@ class NewsService implements NewsServiceInterface
                 $childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)
                     ->selectRaw("category_id, alias, CONCAT( ?, aLIas_pinyin, '/') as aLIas_pinyin", [$parent_pinyin])
                     ->first();
+                $child_pinyin = $childCategoryInfo->aLIas_pinyin ? $childCategoryInfo->aLIas_pinyin : null;
                     if(empty($childCategoryInfo)){
                         $childImgArticles = [];
                         $childTextArticles = [];
@@ -1001,7 +1005,8 @@ class NewsService implements NewsServiceInterface
                                 'article.introduce',
                                 'article.islink',
                                 'article.linkurl',
-                                'article.copyfrom')
+                                'article.copyfrom',
+                                DB::raw("'$child_pinyin' as pinyin"))
                             ->where('imgurl', '!=', '')
                             ->orderBy('updated_at', 'desc')
                             ->limit($childImgNum)
@@ -1022,7 +1027,8 @@ class NewsService implements NewsServiceInterface
                                 'article.introduce',
                                 'article.islink',
                                 'article.linkurl',
-                                'article.copyfrom')
+                                'article.copyfrom',
+                                DB::raw("'$child_pinyin' as pinyin"))
                             ->orderBy('updated_at', 'desc')
                             ->limit($childTextNum)
                             ->get()->all();