From ca776744cb935dbb4d5aa627d351c6d1e6faa218 Mon Sep 17 00:00:00 2001 From: augushong Date: Wed, 28 Oct 2020 18:32:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E7=B1=BB=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/model/Category.php | 2 +- config/session.php | 2 +- .../migrations/20200418120827_create_table_category.php | 1 + view/admin/category/create.html | 9 +++++++++ view/admin/category/edit.html | 9 +++++++++ view/admin/category/index.html | 2 ++ 6 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/model/Category.php b/app/model/Category.php index ad70228..8ef5cb3 100644 --- a/app/model/Category.php +++ b/app/model/Category.php @@ -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); } diff --git a/config/session.php b/config/session.php index c1ef6e1..bb777a8 100644 --- a/config/session.php +++ b/config/session.php @@ -13,7 +13,7 @@ return [ // 存储连接标识 当type使用cache的时候有效 'store' => null, // 过期时间 - 'expire' => 1440, + 'expire' => 36000, // 前缀 'prefix' => '', ]; diff --git a/database/migrations/20200418120827_create_table_category.php b/database/migrations/20200418120827_create_table_category.php index 2f827c1..3fd27a8 100644 --- a/database/migrations/20200418120827_create_table_category.php +++ b/database/migrations/20200418120827_create_table_category.php @@ -36,6 +36,7 @@ class CreateTableCategory extends Migrator ->addColumn(ColumnFormat::timestamp('update_time')) ->addColumn(ColumnFormat::timestamp('delete_time')) ->addColumn(ColumnFormat::integer('pid')->setComment('上级id')) + ->addColumn(ColumnFormat::integer('sort')->setComment('排序:越小越靠前')) ->addColumn(ColumnFormat::integer('level')->setDefault(1)->setComment('层级')) ->addColumn(ColumnFormat::stringShort('tpl_name')->setComment('模板名称')) ->addColumn(ColumnFormat::stringUrl('title_img')->setComment('附图')) diff --git a/view/admin/category/create.html b/view/admin/category/create.html index a5eb721..7956224 100644 --- a/view/admin/category/create.html +++ b/view/admin/category/create.html @@ -91,6 +91,15 @@ +
+
+ 排序 +

越小越靠前

+
+
+ +
+
diff --git a/view/admin/category/edit.html b/view/admin/category/edit.html index e8653e5..72df3a8 100644 --- a/view/admin/category/edit.html +++ b/view/admin/category/edit.html @@ -92,6 +92,15 @@ +
+
+ 排序 +

越小越靠前

+
+
+ +
+
diff --git a/view/admin/category/index.html b/view/admin/category/index.html index e92b8b2..0b3a2ef 100644 --- a/view/admin/category/index.html +++ b/view/admin/category/index.html @@ -42,6 +42,7 @@ ID 名称 模板 + 排序 操作 @@ -52,6 +53,7 @@ {$vo.id} {:str_repeat('|--',$vo.level)} {$vo.title} {$vo.tpl_name} + {$vo.sort}
查看