|
|
@@ -426,7 +426,31 @@ class NewsService implements NewsServiceInterface
|
|
|
$where[] = ['article.admin_user_id', '=', $user_id];
|
|
|
}
|
|
|
|
|
|
- $rep = Article::where($where)
|
|
|
+ // $rep = Article::where($where)
|
|
|
+ // ->whereNotIn('article.status', [404])
|
|
|
+ // ->when($status1, function ($query) use ($status1) {
|
|
|
+ // if (isset($status1) && $status1) {
|
|
|
+ // $query->whereIn('article.status', $status1);
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // ->leftJoin('category', 'article.catid', 'category.id')
|
|
|
+ // ->leftJoin('website_category', function ($join) {
|
|
|
+ // $join->on('article.web_site_id', '=', 'website_category.website_id')
|
|
|
+ // ->on('article.catid', '=', 'website_category.category_id');
|
|
|
+ // })
|
|
|
+ // ->when($type_id != 10000 && !empty($data['website_id']), function ($query) use ($data) {
|
|
|
+ // $query->leftJoin('article_ignore', function ($join) use ($data) {
|
|
|
+ // $join->on('article.id', '=', 'article_ignore.article_id')
|
|
|
+ // ->where('article_ignore.website_id', $data['website_id']);
|
|
|
+ // });
|
|
|
+ // })
|
|
|
+ // ->select("article.*", "category.name as category_name", "website_category.alias",
|
|
|
+ // Db::raw('IFNULL(article_ignore.c_show_time, "") as c_show_time'))
|
|
|
+ // ->orderBy("article.updated_at", "desc")
|
|
|
+ // ->limit($data['pageSize'])
|
|
|
+ // ->offset(($data['page'] - 1) * $data['pageSize'])->get();
|
|
|
+ //
|
|
|
+ $query = Article::where($where)
|
|
|
->whereNotIn('article.status', [404])
|
|
|
->when($status1, function ($query) use ($status1) {
|
|
|
if (isset($status1) && $status1) {
|
|
|
@@ -437,25 +461,26 @@ class NewsService implements NewsServiceInterface
|
|
|
->leftJoin('website_category', function ($join) {
|
|
|
$join->on('article.web_site_id', '=', 'website_category.website_id')
|
|
|
->on('article.catid', '=', 'website_category.category_id');
|
|
|
- })
|
|
|
- ->when($type_id != 10000 && !empty($data['website_id']), function ($query) use ($data) {
|
|
|
- $query->leftJoin('article_ignore', function ($join) use ($data) {
|
|
|
- $join->on('article.id', '=', 'article_ignore.article_id')
|
|
|
- ->where('article_ignore.website_id', $data['website_id']);
|
|
|
- });
|
|
|
- })
|
|
|
- ->select("article.*", "category.name as category_name", "website_category.alias",
|
|
|
- Db::raw('IFNULL(article_ignore.c_show_time, "") as c_show_time'))
|
|
|
- ->orderBy("article.updated_at", "desc")
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])->get();
|
|
|
- $count = Article::where($where)->whereNotIn('article.status', [404])
|
|
|
- ->when($status1, function ($query) use ($status1) {
|
|
|
- if (isset($status1) && $status1) {
|
|
|
- $query->whereIn('article.status', $status1);
|
|
|
- }
|
|
|
- })
|
|
|
- ->leftJoin('category', 'article.catid', 'category.id')->count();
|
|
|
+ });
|
|
|
+
|
|
|
+ if ($type_id != 10000 && !empty($data['website_id'])) {
|
|
|
+ $query = $query
|
|
|
+ ->leftJoin('article_ignore', function ($join) use ($data) {
|
|
|
+ $join->on('article.id', '=', 'article_ignore.article_id')
|
|
|
+ ->where('article_ignore.website_id', $data['website_id']);
|
|
|
+ })
|
|
|
+ ->select("article.*", "category.name as category_name", "website_category.alias",'article_ignore.c_show_time');
|
|
|
+ } else {
|
|
|
+ $query = $query
|
|
|
+ ->select("article.*", "category.name as category_name", "website_category.alias");
|
|
|
+ }
|
|
|
+
|
|
|
+ $rep = $query
|
|
|
+ ->orderBy("article.updated_at", "desc")
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->get();
|
|
|
+ $count = $query->count();
|
|
|
$data = [
|
|
|
'rows' => $rep->toArray(),
|
|
|
'count' => $count,
|