refactor: 修改导航项链接类型字段

This commit is contained in:
2025-03-15 10:03:06 +08:00
parent 67f5a529ca
commit 15c467717b
9 changed files with 16 additions and 62 deletions

View File

@@ -21,7 +21,7 @@ class NavigationItemValidate extends Validate
'pid' => 'integer|different:id|checkPidNotBeChildren',
'name' => 'require|max:64',
'icon' => 'max:64',
'link_type' => 'require|integer',
'link_to' => 'require|max:64|in:article,article_category,product,product_category,custom',
'link' => 'max:255',
'sort' => 'integer',
'blank' => 'in:0,1',
@@ -45,8 +45,9 @@ class NavigationItemValidate extends Validate
'name.require' => '导航名称不能为空',
'name.max' => '导航名称最多不能超过64个字符',
'icon.max' => '图标最多不能超过64个字符',
'link_type.require' => '链接类型不能为空',
'link_type.integer' => '链接类型必须为整数',
'link_to.require' => '链接类型不能为空',
'link_to.max' => '链接类型最多不能超过64个字符',
'link_to.in' => '链接类型必须是article,goods_category,goods,custom中之一',
'link.max' => '链接最多不能超过255个字符',
'sort.integer' => '排序必须为整数',
'blank.in' => '是否新窗口打开只能是0或1',
@@ -83,12 +84,12 @@ class NavigationItemValidate extends Validate
// 新增场景
public function sceneAdd()
{
return $this->only(['nav_id', 'pid', 'name', 'icon', 'link_type', 'link', 'sort', 'blank', 'status'])->remove('pid', 'different|checkPidNotBeChildren');
return $this->only(['nav_id', 'pid', 'name', 'icon', 'link_to', 'link', 'sort', 'blank', 'status'])->remove('pid', 'different|checkPidNotBeChildren');
}
// 更新场景
public function sceneEdit()
{
return $this->only(['id', 'nav_id', 'pid', 'name', 'icon', 'link_type', 'link', 'sort', 'blank', 'status']);
return $this->only(['id', 'nav_id', 'pid', 'name', 'icon', 'link_to', 'link', 'sort', 'blank', 'status']);
}
}

View File

@@ -23,7 +23,7 @@ class SysBannerItemValidate extends Validate
'type' => 'in:image,video',
'image' => 'max:255',
'video' => 'max:255',
'link_to' => 'max:64|in:article,goods_category,goods,custom',
'link_to' => 'require|max:64|in:article,article_category,product,product_category,custom',
'link' => 'max:255',
'sort' => 'integer',
'status' => 'in:-1,1'
@@ -48,8 +48,9 @@ class SysBannerItemValidate extends Validate
'type.in' => '显示类型必须是image或video',
'image.max' => '图片地址最多不能超过255个字符',
'video.max' => '视频地址最多不能超过255个字符',
'link_to.require' => '连接类型不能为空',
'link_to.max' => '连接类型最多不能超过64个字符',
'link_to.in' => '连接类型必须是article,goods_category,goods,custom中之一',
'link_to.in' => '连接类型必须是article,article_category,product,product_category,custom中之一',
'link.max' => '连接最多不能超过255个字符',
'sort.integer' => '排序值必须是整数',
'status.in' => '状态必须是-1或1'