|
|
@@ -469,9 +469,17 @@ class NewsService implements NewsServiceInterface
|
|
|
$query->whereIn('article.status', $status1);
|
|
|
}
|
|
|
})
|
|
|
+ ->select('article.*')
|
|
|
// 非管理员限制
|
|
|
->when($type_id != 10000, function ($query) use ($user_id) {
|
|
|
- $query->where('article.admin_user_id', '=', $user_id);
|
|
|
+ // 非管理员只能看自己的文章,同时把 article_ignore 的 c_show_time 一起查出来
|
|
|
+ $query->where('article.admin_user_id', $user_id)
|
|
|
+ ->leftJoin('article_ignore', function ($join) {
|
|
|
+ // 关联条件:article.id = article_ignore.article_id 且 article.web_site_id = article_ignore.website_id
|
|
|
+ $join->on('article_ignore.article_id', '=', 'article.id')
|
|
|
+ ->whereColumn('article_ignore.website_id', 'article.web_site_id');
|
|
|
+ })
|
|
|
+ ->addSelect('article_ignore.article_id','article_ignore.c_show_time'); // 用 addSelect 追加字段,避免覆盖原有 select
|
|
|
})
|
|
|
// 基础条件
|
|
|
->whereNotIn('article.status', [404])
|