47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
![]() |
<?php
|
||
|
/**
|
||
|
* 用户验证器
|
||
|
*/
|
||
|
|
||
|
namespace app\common\validate;
|
||
|
|
||
|
class UserValidate extends Validate
|
||
|
{
|
||
|
protected $rule = [
|
||
|
'account|账号' => 'require|length:6,20|alphaNum|unique:user',
|
||
|
'password|密码' => 'require|length:4,16|alphaNum',
|
||
|
'token|密码' => 'require|length:4,16|alphaNum',
|
||
|
|
||
|
|
||
|
];
|
||
|
|
||
|
protected $message = [
|
||
|
'account.require' => '账号不能为空',
|
||
|
'account.length' => '账号只能6-20位数',
|
||
|
'account.alphaNum' => '账号只能是字母或数字组成',
|
||
|
'account.unique' => '账号已存在',
|
||
|
|
||
|
'password.require' => '密码不能为空',
|
||
|
'password.length' => '密码只能4-16位',
|
||
|
'password.alphaNum' => '密码只能是字母或数字组成',
|
||
|
|
||
|
'accountId.require' => '账号不能为空',
|
||
|
'accountId.length' => '账号只能4-10位数',
|
||
|
'accountId.alphaNum' => '账号只能是字母或数字组成',
|
||
|
'accountId.unique' => '该账号已存在,请登陆或重新注册',
|
||
|
|
||
|
'token.require' => '密码不能为空',
|
||
|
'token.length' => '密码只能4-16位',
|
||
|
'token.alphaNum' => '密码只能是字母或数字组成',
|
||
|
|
||
|
];
|
||
|
|
||
|
protected $scene = [
|
||
|
'reg' => ['account', 'password',],
|
||
|
'login' => ['accountId', 'token',],
|
||
|
|
||
|
];
|
||
|
|
||
|
|
||
|
}
|