mirror of
https://gitee.com/ulthon/ulthon_information.git
synced 2026-03-03 16:24:28 +08:00
优化子分类显示;
This commit is contained in:
@@ -42,7 +42,9 @@ class Index extends Common
|
||||
$page_title = $current_category->title;
|
||||
|
||||
$sub_category = Category::where('pid', $category_id)->where('type', 3)->order('sort asc')->select();
|
||||
if (empty($this->request->param('sub_category_id'))) {
|
||||
|
||||
$sub_category_id = $this->request->param('sub_category_id');
|
||||
if (empty($sub_category_id)) {
|
||||
$categorys = [$category_id];
|
||||
|
||||
$categorys = array_merge($categorys, array_column((array)Category::getListLevel($category_id), 3));
|
||||
@@ -51,8 +53,11 @@ class Index extends Common
|
||||
|
||||
$model_post = Post::hasWhere('categorys', $categorys_where)->where('status', 1)->order('id desc');
|
||||
} else {
|
||||
$page_title .= "|{$sub_category->title}";
|
||||
$model_post = Post::hasWhere('categorys', ['category_id' => $this->request->param('sub_category_id')])->where('status', 1)->order('id desc');
|
||||
|
||||
$model_sub_category = Category::find($sub_category_id);
|
||||
|
||||
$page_title .= "|{$model_sub_category->title}";
|
||||
$model_post = Post::hasWhere('categorys', ['category_id' => $sub_category_id])->where('status', 1)->order('id desc');
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user