refactor: banner|navigation
All checks were successful
Gitea Actions Official-website / deploy-dev (push) Successful in 4s

This commit is contained in:
2026-03-27 17:59:08 +08:00
parent 8577877f83
commit 9584b81729
4 changed files with 22 additions and 8 deletions

View File

@@ -67,6 +67,8 @@ class NavigationItem
'id',
'pid',
'name',
'desc',
'image',
'nav_id',
'sort',
'status',
@@ -93,7 +95,9 @@ class NavigationItem
'pid',
'nav_id',
'name',
'desc',
'icon',
'image',
'link_to' => 'custom',
'link',
'sort',
@@ -121,7 +125,9 @@ class NavigationItem
'pid',
'nav_id',
'name',
'desc',
'icon',
'image',
'link_to',
'link',
'sort',

View File

@@ -20,7 +20,9 @@ class NavigationItemValidate extends Validate
'nav_id' => 'require|integer',
'pid' => 'integer|different:id|checkPidNotBeChildren',
'name' => 'require|max:64',
'desc' => 'max:255',
'icon' => 'max:64',
'image' => 'max:255',
'link_to' => 'require|max:64|in:article,article_category,product,product_category,system_page,custom',
'link' => 'max:255',
'sort' => 'integer',
@@ -44,7 +46,9 @@ class NavigationItemValidate extends Validate
'pid.checkPidNotBeChildren' => '父级ID不能为自身的子导航',
'name.require' => '导航名称不能为空',
'name.max' => '导航名称最多不能超过64个字符',
'desc.max' => '导航名称最多不能超过:rule个字符',
'icon.max' => '图标最多不能超过64个字符',
'image.max' => '图标最多不能超过:rule个字符',
'link_to.require' => '链接类型不能为空',
'link_to.max' => '链接类型最多不能超过64个字符',
'link_to.in' => '链接类型必须是article,article_category,product_category,product,system_page,custom中之一',

View File

@@ -21,7 +21,9 @@ class SysNavigationItemBaseModel extends BaseModel
'nav_id' => 'int',
'pid' => 'int',
'name' => 'string',
'desc' => 'string',
'icon' => 'string',
'image' => 'string',
'link_to' => 'string',
'link' => 'string',
'sort' => 'int',

View File

@@ -31,7 +31,9 @@ class CreateSysNavigationItem extends Migrator
$table->addColumn('nav_id', 'string', ['limit' => 64, 'null' => false, 'comment' => '所属导航ID'])
->addColumn('pid', 'integer', ['null' => false, 'default' => 0, 'comment' => '父级ID'])
->addColumn('name', 'string', ['limit' => 64, 'null' => false, 'comment' => '名称'])
->addColumn('desc', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '描述'])
->addColumn('icon', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '图标'])
->addColumn('image', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '图片'])
->addColumn('link_to', 'string', ['limit' => 64, 'null' => true, 'default' => null, 'comment' => '链接到(类型): article:文章, article_category:文章分类, product:产品, product_category:产品分类, custom:自定义链接'])
->addColumn('link', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '链接'])
->addColumn('sort', 'integer', ['limit' => 11, 'null' => false, 'default' => 0, 'comment' => '排序'])