Bladeren bron

Merge branch 'web_sannong_fr'

15313670163 3 weken geleden
bovenliggende
commit
5a73c8838e
2 gewijzigde bestanden met toevoegingen van 41 en 0 verwijderingen
  1. 36 0
      app/JsonRpc/NewsService.php
  2. 5 0
      app/JsonRpc/NewsServiceInterface.php

+ 36 - 0
app/JsonRpc/NewsService.php

@@ -1373,6 +1373,42 @@ class NewsService implements NewsServiceInterface
         return Result::success($result);
                 // return Result::success($data);
     }
+    /**
+     * 乡村网-获取特殊新闻模块
+     * @param array $data
+     * @return array
+     */
+    public function getWebsiteArticles(array $data): array
+    {
+        $web = Website::where('id',$data['website_id'])->first();
+        if(empty($web)){
+            return Result::error("暂无此网站",0);
+        }
+        $where = [
+            // 'article.catid' => $data['catid'],
+            'article.status' => 1,
+        ];
+        $articles['img'] = Article::where($where)
+            ->where('imgurl', '!=', '')
+            ->whereNotNull('imgurl')
+            ->whereRaw("JSON_CONTAINS(category_arr_id, '".intval($data['catid'])."')")
+            ->leftJoin('website_category', 'website_category.category_id', 'article.catid','website_category.aLIas_pinyin')
+            ->select('article.*','website_category.category_id','website_category.alias')
+            ->orderBy('updated_at', 'desc')
+            ->limit($data['img_num'])
+            ->get()->all();
+        $articles['text'] = Article::where($where)
+            ->whereRaw("JSON_CONTAINS(category_arr_id, '".intval($data['catid'])."')")
+            ->leftJoin('website_category', 'website_category.category_id', 'article.catid')
+            ->select('article.*','website_category.category_id','website_category.alias','website_category.aLIas_pinyin')
+            ->orderBy('updated_at', 'desc')
+            ->limit($data['text_num'])
+            ->get()->all();
+        if(empty($articles)){
+            return Result::error("暂无此栏目",0); 
+        }
+        return Result::success($articles);
+    }
 
     /**
      * 验证导航名称是否重复

+ 5 - 0
app/JsonRpc/NewsServiceInterface.php

@@ -175,4 +175,9 @@ interface NewsServiceInterface
      * @return array
      */
     public function getWebsiteAllArticle(array $data):array;
+    /**
+     * @param array $data
+     * @return array
+     */
+    public function getWebsiteArticles(array $data):array;
 }