|
|
@@ -1531,9 +1531,23 @@ class NewsService implements NewsServiceInterface
|
|
|
$result = Article::where($where)
|
|
|
->leftJoin("article_data", "article.id", "article_data.article_id")
|
|
|
->leftJoin("article_extend", "article_extend.article_id", "article.id")
|
|
|
- ->where(function ($query) use ($data) {
|
|
|
- $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
- ->orWhereNull("ignore_ids");
|
|
|
+ // ->where(function ($query) use ($data) {
|
|
|
+ // $query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
+ // ->orWhereNull("ignore_ids");
|
|
|
+ // })
|
|
|
+ ->leftJoinSub(function ($query) use ($data) {
|
|
|
+ $query->from('article_ignore')
|
|
|
+ ->where('website_id', $data['website_id']);
|
|
|
+ }, 'article_ignore', function ($join) {
|
|
|
+ $join->on('article_ignore.article_id', '=', 'article.id');
|
|
|
+ })
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'));
|
|
|
+ });
|
|
|
})
|
|
|
->select(
|
|
|
'article.*',
|
|
|
@@ -1571,6 +1585,20 @@ class NewsService implements NewsServiceInterface
|
|
|
//去除不存在的文章ID
|
|
|
$commendArticle = Article::whereIn('article.id', $commend_ids)
|
|
|
->leftjoin('website_category', 'website_category.category_id', '=', 'article.catid')
|
|
|
+ ->leftJoinSub(function ($query) use ($data) {
|
|
|
+ $query->from('article_ignore')
|
|
|
+ ->where('website_id', $data['website_id']);
|
|
|
+ }, 'article_ignore', function ($join) {
|
|
|
+ $join->on('article_ignore.article_id', '=', 'article.id');
|
|
|
+ })
|
|
|
+ ->where(function ($query) {
|
|
|
+ $query->whereNull('article_ignore.article_id')
|
|
|
+ ->orWhere(function ($subQuery) {
|
|
|
+ $subQuery->whereNotNull('article_ignore.article_id')
|
|
|
+ ->where('article_ignore.is_ignore', 0)
|
|
|
+ ->where('article_ignore.c_show_time', '<=', date('Y-m-d H:i:s'));
|
|
|
+ });
|
|
|
+ })
|
|
|
->where('article.status', 1)
|
|
|
->where('website_category.website_id', $data['website_id'])
|
|
|
->select('article.id', 'article.cat_arr_id', 'article.title', 'article.catid', 'article.imgurl', 'article.hits', 'article.created_at', 'website_category.alias', 'website_category.alias_pinyin', 'website_category.website_id')
|