refactor: 修改文章验证

This commit is contained in:
2025-03-25 10:47:00 +08:00
parent a18b0088da
commit 159f216496
2 changed files with 1 additions and 3 deletions

View File

@@ -21,7 +21,6 @@ class ArticleValidate extends Validate
'link' => 'max:255', 'link' => 'max:255',
'desc' => 'max:255', 'desc' => 'max:255',
'sort' => 'integer', 'sort' => 'integer',
'content' => 'require',
'recommend' => 'require|in:0,1', 'recommend' => 'require|in:0,1',
'release_time' => 'dateFormat:Y-m-d H:i:s', 'release_time' => 'dateFormat:Y-m-d H:i:s',
'seo_title' => 'max:255', 'seo_title' => 'max:255',
@@ -46,7 +45,6 @@ class ArticleValidate extends Validate
'link.max' => '链接地址长度不能超过255个字符', 'link.max' => '链接地址长度不能超过255个字符',
'desc.max' => '描述长度不能超过255个字符', 'desc.max' => '描述长度不能超过255个字符',
'sort.integer' => '排序格式不正确', 'sort.integer' => '排序格式不正确',
'content.require' => '内容不能为空',
'recommend.require' => '推荐状态不能为空', 'recommend.require' => '推荐状态不能为空',
'recommend.in' => '推荐状态的值必须是0或1', 'recommend.in' => '推荐状态的值必须是0或1',
'release_time.dateFormat' => '发布时间格式不正确', 'release_time.dateFormat' => '发布时间格式不正确',

View File

@@ -38,7 +38,7 @@ class CreateArticle extends Migrator
->addColumn('recommend', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否推荐:1是,0否']) ->addColumn('recommend', 'boolean', ['null' => false, 'default' => 0, 'comment' => '是否推荐:1是,0否'])
->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序']) ->addColumn('sort', 'integer', ['null' => false, 'default' => 0, 'comment' => '排序'])
->addColumn('link', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '外链']) ->addColumn('link', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => '外链'])
->addColumn('content', 'text', ['null' => false, 'comment' => '内容']) ->addColumn('content', 'text', ['null' => true, 'default' => null, 'comment' => '内容'])
->addColumn('view_count', 'integer', ['null' => false, 'default' => 0, 'comment' => '浏览量']) ->addColumn('view_count', 'integer', ['null' => false, 'default' => 0, 'comment' => '浏览量'])
->addColumn('praise_count', 'integer', ['null' => false, 'default' => 0, 'comment' => '点赞量']) ->addColumn('praise_count', 'integer', ['null' => false, 'default' => 0, 'comment' => '点赞量'])
->addColumn('seo_title', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => 'SEO标题']) ->addColumn('seo_title', 'string', ['limit' => 255, 'null' => true, 'default' => null, 'comment' => 'SEO标题'])