|
@@ -664,15 +664,14 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
- ->orderBy("updated_at", "desc")
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->get();
|
|
|
-
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->orderBy("updated_at", "desc")
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->get();
|
|
|
$count = Article::where(function ($query) use ($where) {
|
|
|
foreach ($where as $condition) {
|
|
|
if ($condition[1] === 'in') {
|
|
@@ -705,21 +704,28 @@ class NewsService implements NewsServiceInterface
|
|
|
'article.id' => $data['id'],
|
|
|
'article.status' => 1,
|
|
|
];
|
|
|
- $result = Article::where($where)->leftJoin("article_data", "article.id", "article_data.article_id")
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
- })
|
|
|
+
|
|
|
+ $result = Article::where($where)->leftJoin("article_data","article.id","article_data.article_id")
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
+ $query->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0")
|
|
|
+ ->orWhereNull("ignore_ids");
|
|
|
+ })
|
|
|
+ ->first();
|
|
|
+ if(empty($result)){
|
|
|
+ return Result::error("暂无此新闻!",0);
|
|
|
+ }
|
|
|
+ $category = WebsiteCategory::leftJoin('website', 'website.id', '=', 'website_category.website_id')
|
|
|
+ ->select('website_category.*', 'website.website_name', 'website.suffix')
|
|
|
+ ->where('website_category.website_id', $data['website_id'])
|
|
|
+ ->where(['website_category.category_id' => $result['catid']])
|
|
|
->first();
|
|
|
- if (empty($result)) {
|
|
|
- return Result::error("暂无此新闻!", 0);
|
|
|
- }
|
|
|
- $category = WebsiteCategory::where('website_id', $data['website_id'])->where(['category_id' => $result['catid']])->first();
|
|
|
if (empty($category)) {
|
|
|
return Result::error("查询失败", 0);
|
|
|
}
|
|
|
$result['category_id'] = $category['category_id'];
|
|
|
- $result['cat_name'] = $category['name'];
|
|
|
+ $result['cat_name'] = $category['alias'];
|
|
|
+ $result['website_name'] = $category['website_name']??"";
|
|
|
+ $result['suffix'] = $category['suffix']??"";
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/**
|
|
@@ -972,7 +978,7 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
+ /**
|
|
|
* 前端-搜索新闻列表
|
|
|
* @param array $data
|
|
|
* @return array
|