调整列表

This commit is contained in:
2021-02-04 10:57:43 +08:00
parent 0e70658aeb
commit e188a9a3f2
2 changed files with 9 additions and 1 deletions

View File

@@ -181,6 +181,7 @@ function getArtilesByCates($cate_id, $take = 8)
{ {
$cate_ids = Category::where('parent_id', $cate_id) $cate_ids = Category::where('parent_id', $cate_id)
->orWhere('id', $cate_id) ->orWhere('id', $cate_id)
->where('status', 1)
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]) ->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
->pluck('id') ->pluck('id')
->toArray(); ->toArray();

View File

@@ -38,7 +38,14 @@ class CategoryController extends Controller
$template = 'category.persons'; $template = 'category.persons';
} }
$articles = Article::where('category_id', $category->id) $cate_ids = Category::where('parent_id', $category->id)
->orWhere('id', $category->id)
->where('status', 1)
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
->pluck('id')
->toArray();
$articles = Article::whereIn('category_id', $cate_ids)
->where('status', 1) ->where('status', 1)
->latest('sort') ->latest('sort')
->latest() ->latest()