|
@@ -1220,6 +1220,11 @@ class NewsService implements NewsServiceInterface
|
|
|
|
|
|
// 查询所有子级栏目的图文新闻
|
|
// 查询所有子级栏目的图文新闻
|
|
$imgArticles = Article::where('catid', $childCategoryIds[0])
|
|
$imgArticles = Article::where('catid', $childCategoryIds[0])
|
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
|
+ $query->where(function ($subQuery) use ($data) {
|
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0");
|
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
|
+ })
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
->where('imgurl', '!=', '')
|
|
->where('imgurl', '!=', '')
|
|
->select('*')
|
|
->select('*')
|
|
@@ -1231,6 +1236,11 @@ class NewsService implements NewsServiceInterface
|
|
// 查询所有子级栏目的文字新闻
|
|
// 查询所有子级栏目的文字新闻
|
|
$textArticles = Article::where('catid', $childCategoryIds[0])
|
|
$textArticles = Article::where('catid', $childCategoryIds[0])
|
|
->where('status', 1)
|
|
->where('status', 1)
|
|
|
|
+ ->where(function ($query) use ($data) {
|
|
|
|
+ $query->where(function ($subQuery) use ($data) {
|
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($data['website_id'])."') = 0");
|
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
|
+ })
|
|
// ->where(function ($query) {
|
|
// ->where(function ($query) {
|
|
// $query->whereNull('imgurl')
|
|
// $query->whereNull('imgurl')
|
|
// ->orWhere('imgurl', '');
|
|
// ->orWhere('imgurl', '');
|
|
@@ -1309,23 +1319,36 @@ class NewsService implements NewsServiceInterface
|
|
}else{
|
|
}else{
|
|
// 查询图片新闻
|
|
// 查询图片新闻
|
|
$imgArticles = Article::where('catid', $parentCatId)
|
|
$imgArticles = Article::where('catid', $parentCatId)
|
|
|
|
+ ->where('status', 1)
|
|
|
|
+ ->where(function ($query) use ($website) {
|
|
|
|
+ $query->where(function ($subQuery) use ($website) {
|
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($website['website_id'])."') = 0");
|
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
|
+ })
|
|
->where('imgurl', '!=', '')
|
|
->where('imgurl', '!=', '')
|
|
- // ->where($website)
|
|
|
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
->limit($parentImgNum)
|
|
->limit($parentImgNum)
|
|
->get()->all();
|
|
->get()->all();
|
|
|
|
|
|
// 查询文字新闻
|
|
// 查询文字新闻
|
|
$textArticles = Article::where('catid', $parentCatId)
|
|
$textArticles = Article::where('catid', $parentCatId)
|
|
- // ->where($website)
|
|
|
|
|
|
+ ->where('status', 1)
|
|
|
|
+ ->where(function ($query) use ($website) {
|
|
|
|
+ $query->where(function ($subQuery) use ($website) {
|
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($website['website_id'])."') = 0");
|
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
|
+ })
|
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
->limit($parentTextNum)
|
|
->limit($parentTextNum)
|
|
->get()->all();
|
|
->get()->all();
|
|
}
|
|
}
|
|
$resultItem = [
|
|
$resultItem = [
|
|
'alias' => $category ? $category->alias : null,
|
|
'alias' => $category ? $category->alias : null,
|
|
'category_id' => $parentCatId,
|
|
'category_id' => $parentCatId,
|
|
|
|
+ 'pinyin' => $category->aLIas_pinyin ?? '',
|
|
'imgnum' => $imgArticles,
|
|
'imgnum' => $imgArticles,
|
|
'textnum' => $textArticles,
|
|
'textnum' => $textArticles,
|
|
- 'pinyin' => $category->aLIas_pinyin ?? '',
|
|
|
|
|
|
+
|
|
];
|
|
];
|
|
|
|
|
|
if (!empty($item['child']) && $item['child'] != "") {
|
|
if (!empty($item['child']) && $item['child'] != "") {
|
|
@@ -1333,7 +1356,6 @@ class NewsService implements NewsServiceInterface
|
|
$childCategory = WebsiteCategory::where('pid', $parentCatId)->where($website)->select('category_id','alias','aLIas_pinyin')->get()->all();
|
|
$childCategory = WebsiteCategory::where('pid', $parentCatId)->where($website)->select('category_id','alias','aLIas_pinyin')->get()->all();
|
|
if ($childCategory) {
|
|
if ($childCategory) {
|
|
list($childCatId, $childImgNum, $childTextNum) = explode(',', $item['child']);
|
|
list($childCatId, $childImgNum, $childTextNum) = explode(',', $item['child']);
|
|
-
|
|
|
|
// 查询子栏目名称
|
|
// 查询子栏目名称
|
|
$childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)->first(['alias', 'category_id','aLIas_pinyin']);
|
|
$childCategoryInfo = WebsiteCategory::where('category_id', $childCatId)->where($website)->first(['alias', 'category_id','aLIas_pinyin']);
|
|
// $childAllCartegory = WebsiteCategory::where('pid', $childCatId)->where($website)->first(['category_id']);
|
|
// $childAllCartegory = WebsiteCategory::where('pid', $childCatId)->where($website)->first(['category_id']);
|
|
@@ -1343,26 +1365,36 @@ class NewsService implements NewsServiceInterface
|
|
}else{
|
|
}else{
|
|
// 查询子栏目图片新闻
|
|
// 查询子栏目图片新闻
|
|
$childImgArticles = Article::where('catid', $childCatId)
|
|
$childImgArticles = Article::where('catid', $childCatId)
|
|
- ->where('imgurl', '!=', '')
|
|
|
|
- // ->where($website)
|
|
|
|
- ->limit($childImgNum)
|
|
|
|
- ->get()->all();
|
|
|
|
-
|
|
|
|
|
|
+ ->where('status', 1)
|
|
|
|
+ ->where(function ($query) use ($website) {
|
|
|
|
+ $query->where(function ($subQuery) use ($website) {
|
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($website['website_id'])."') = 0");
|
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
|
+ })
|
|
|
|
+ ->where('imgurl', '!=', '')
|
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
|
+ ->limit($childImgNum)
|
|
|
|
+ ->get()->all();
|
|
// 查询子栏目文字新闻
|
|
// 查询子栏目文字新闻
|
|
$childTextArticles = Article::where('catid', $childCatId)
|
|
$childTextArticles = Article::where('catid', $childCatId)
|
|
- // ->where($website)
|
|
|
|
|
|
+ ->where('status', 1)
|
|
|
|
+ ->where(function ($query) use ($website) {
|
|
|
|
+ $query->where(function ($subQuery) use ($website) {
|
|
|
|
+ $subQuery->whereRaw("JSON_CONTAINS(ignore_ids, '".intval($website['website_id'])."') = 0");
|
|
|
|
+ })->orWhereNull("ignore_ids");
|
|
|
|
+ })
|
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
->limit($childTextNum)
|
|
->limit($childTextNum)
|
|
->get()->all();
|
|
->get()->all();
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
$resultItem['child'] = [
|
|
$resultItem['child'] = [
|
|
'alias' => $childCategoryInfo ? $childCategoryInfo->alias : null,
|
|
'alias' => $childCategoryInfo ? $childCategoryInfo->alias : null,
|
|
'category_id' => $childCatId,
|
|
'category_id' => $childCatId,
|
|
|
|
+ 'pinyin' => $childCategoryInfo->aLIas_pinyin?? '',
|
|
'all_childcat' => $childCategory,
|
|
'all_childcat' => $childCategory,
|
|
'imgnum' => $childImgArticles,
|
|
'imgnum' => $childImgArticles,
|
|
'textnum' => $childTextArticles,
|
|
'textnum' => $childTextArticles,
|
|
- 'pinyin' => $childCategoryInfo->aLIas_pinyin?? '',
|
|
|
|
|
|
+
|
|
];
|
|
];
|
|
// $resultItem['pinyin'] = $childCategoryInfo->aLIas_pinyin ?? '';
|
|
// $resultItem['pinyin'] = $childCategoryInfo->aLIas_pinyin ?? '';
|
|
}
|
|
}
|