新增分类排序

This commit is contained in:
augushong
2020-10-29 15:17:04 +08:00
parent 8f7f4c826a
commit 04d7bd0743
6 changed files with 23 additions and 3 deletions

View File

@@ -23,7 +23,7 @@ class Common extends BaseController
$list_header_nav = Nav::where('type', 11)->order('sort asc')->where('status', 1)->select();
View::assign('list_header_nav', $list_header_nav);
$list_category_first_level = Category::where('level', 1)->where('status', 1)->where('type',3)->select();
$list_category_first_level = Category::where('level', 1)->where('status', 1)->where('type',3)->order('sort asc')->select();
View::assign('list_category_first_level', $list_category_first_level);
$list_nav_more = Nav::where('type', 8)->order('sort asc')->where('status', 1)->select();
View::assign('list_nav_more', $list_nav_more);

View File

@@ -22,7 +22,7 @@ class Index extends Common
$current_category = [];
if (!empty($this->request->param('category_id'))) {
$sub_category = Category::where('pid', $this->request->param('category_id'))->where('type', 3)->select();
$sub_category = Category::where('pid', $this->request->param('category_id'))->where('type', 3)->order('sort asc')->select();
$current_category = Category::find($this->request->param('category_id'));
if (empty($this->request->param('sub_category_id'))) {
$categorys = [$this->request->param('category_id')];

View File

@@ -28,7 +28,7 @@ class Category extends Model
if(empty(self::$allCategory)){
$model_list = Category::where('type',$type)->select();
$model_list = Category::where('type',$type)->order('sort asc')->select();
self::$allCategory = array2level($model_list,0,0);
}