|
@@ -1373,6 +1373,42 @@ class NewsService implements NewsServiceInterface
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
// return Result::success($data);
|
|
// 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);
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 验证导航名称是否重复
|
|
* 验证导航名称是否重复
|