|
@@ -380,52 +380,7 @@ class NewsService implements NewsServiceInterface
|
|
}
|
|
}
|
|
return Result::success($result);
|
|
return Result::success($result);
|
|
}
|
|
}
|
|
- /**
|
|
|
|
- * 模块新闻加强版
|
|
|
|
- * @param array $data
|
|
|
|
- * @return array
|
|
|
|
- */
|
|
|
|
- public function getWebsiteCatidArticle(array $data): array
|
|
|
|
- {
|
|
|
|
- $where = [
|
|
|
|
- // 'category.status' => 1,
|
|
|
|
- 'website_category.category_id' => $data['catid'],
|
|
|
|
- 'website_category.website_id' => $data['website_id'],
|
|
|
|
- // 'article.status' => 1,
|
|
|
|
- ];
|
|
|
|
- // $category = WebsiteCategory::where($where);
|
|
|
|
- if (!empty($data['img_num'])) {
|
|
|
|
- $category['img'] = WebsiteCategory::where($where)
|
|
|
|
- ->leftJoin('article', 'article.catid', 'website_category.category_id')
|
|
|
|
- ->where('article.status', 1)
|
|
|
|
- ->whereNotNull('article.imgurl')
|
|
|
|
- ->select('article.*','website_category.category_id','website_category.alias')
|
|
|
|
- ->orderBy('article.updated_at', 'desc')
|
|
|
|
- ->limit($data['img_num'])
|
|
|
|
- ->get();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!empty($data['text_num'])) {
|
|
|
|
- $category['text'] = WebsiteCategory::where($where)
|
|
|
|
- ->leftJoin('article', 'article.catid', 'website_category.category_id')
|
|
|
|
- ->where('article.status', 1)
|
|
|
|
- ->where(function ($query) {
|
|
|
|
- $query->whereNull('article.imgurl')
|
|
|
|
- ->orWhere('article.imgurl', '');
|
|
|
|
- })
|
|
|
|
- ->select('article.*','website_category.category_id','website_category.alias')
|
|
|
|
- ->orderBy('article.updated_at', 'desc')
|
|
|
|
- ->limit($data['text_num'])
|
|
|
|
- ->get();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // $category = $category->get();
|
|
|
|
-
|
|
|
|
- if(empty($category)){
|
|
|
|
- return Result::error("查询失败", 0);
|
|
|
|
- }
|
|
|
|
- return Result::success($category);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
*获取新闻列表
|
|
*获取新闻列表
|
|
@@ -831,4 +786,52 @@ class NewsService implements NewsServiceInterface
|
|
];
|
|
];
|
|
return Result::success($data);
|
|
return Result::success($data);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 模块新闻加强版
|
|
|
|
+ * @param array $data
|
|
|
|
+ * @return array
|
|
|
|
+ */
|
|
|
|
+ public function getWebsiteCatidArticle(array $data): array
|
|
|
|
+ {
|
|
|
|
+ $where = [
|
|
|
|
+ // 'category.status' => 1,
|
|
|
|
+ 'website_category.category_id' => $data['catid'],
|
|
|
|
+ 'website_category.website_id' => $data['website_id'],
|
|
|
|
+ // 'article.status' => 1,
|
|
|
|
+ ];
|
|
|
|
+ // $category = WebsiteCategory::where($where);
|
|
|
|
+ if (!empty($data['img_num'])) {
|
|
|
|
+ $category['img'] = WebsiteCategory::where($where)
|
|
|
|
+ ->leftJoin('article', 'article.catid', 'website_category.category_id')
|
|
|
|
+ ->where('article.status', 1)
|
|
|
|
+ ->whereNotNull('article.imgurl')
|
|
|
|
+ ->select('article.*','website_category.category_id','website_category.alias')
|
|
|
|
+ ->orderBy('article.updated_at', 'desc')
|
|
|
|
+ ->limit($data['img_num'])
|
|
|
|
+ ->get();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!empty($data['text_num'])) {
|
|
|
|
+ $category['text'] = WebsiteCategory::where($where)
|
|
|
|
+ ->leftJoin('article', 'article.catid', 'website_category.category_id')
|
|
|
|
+ ->where('article.status', 1)
|
|
|
|
+ ->where(function ($query) {
|
|
|
|
+ $query->whereNull('article.imgurl')
|
|
|
|
+ ->orWhere('article.imgurl', '');
|
|
|
|
+ })
|
|
|
|
+ ->select('article.*','website_category.category_id','website_category.alias')
|
|
|
|
+ ->orderBy('article.updated_at', 'desc')
|
|
|
|
+ ->limit($data['text_num'])
|
|
|
|
+ ->get();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // $category = $category->get();
|
|
|
|
+
|
|
|
|
+ if(empty($category)){
|
|
|
|
+ return Result::error("查询失败", 0);
|
|
|
|
+ }
|
|
|
|
+ return Result::success($category);
|
|
|
|
+ }
|
|
}
|
|
}
|