Browse Source

fix:验证器改为最低2个字符

super-yimizi 2 days ago
parent
commit
ec6e42ee18
1 changed files with 6 additions and 6 deletions
  1. 6 6
      application/api/validate/User.php

+ 6 - 6
application/api/validate/User.php

@@ -18,9 +18,9 @@ class User extends Validate
      * 验证规则
      */
     protected $rule = [
-        'account'   => 'require|length:3,30',
-        'username'  => 'length:3,30',
-        'nickname'  => 'length:3,30',
+        'account'   => 'require|length:2,30',
+        'username'  => 'length:2,30',
+        'nickname'  => 'length:2,30',
         'password'  => 'length:6,30',
         'mobile'    => 'regex:/^1\d{10}$/',
         'email'     => 'email',
@@ -45,11 +45,11 @@ class User extends Validate
      */
     protected $message = [
         'account.require'   => '账号不能为空',
-        'account.length'    => '账号长度必须在3-30个字符之间',
+        'account.length'    => '账号长度必须在2-30个字符之间',
         // 'username.require'  => '用户名不能为空',
-        'username.length'   => '用户名长度必须在3-30个字符之间',
+        'username.length'   => '用户名长度必须在2-30个字符之间',
         'nickname.require'  => '昵称不能为空',
-        'nickname.length'   => '昵称长度必须在3-30个字符之间',
+        'nickname.length'   => '昵称长度必须在2-30个字符之间',
         'password.require'  => '密码不能为空',
         'password.length'   => '密码长度必须在6-30个字符之间',
         'mobile.regex'      => '手机号格式不正确',