存客宝应用接口初始化
This commit is contained in:
46
application/common/validate/Auth.php
Normal file
46
application/common/validate/Auth.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
|
||||
/**
|
||||
* 认证相关验证器
|
||||
*/
|
||||
class Auth extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
* @var array
|
||||
*/
|
||||
protected $rule = [
|
||||
'account' => 'require',
|
||||
'password' => 'require|length:6,64',
|
||||
'code' => 'require|length:4,6',
|
||||
'typeId' => 'require|in:1,2',
|
||||
];
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
* @var array
|
||||
*/
|
||||
protected $message = [
|
||||
'account.require' => '账号不能为空',
|
||||
'password.require' => '密码不能为空',
|
||||
'password.length' => '密码长度必须在6-64个字符之间',
|
||||
'code.require' => '验证码不能为空',
|
||||
'code.length' => '验证码长度必须在4-6个字符之间',
|
||||
'typeId.require' => '用户类型不能为空',
|
||||
'typeId.in' => '用户类型错误',
|
||||
];
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
* @var array
|
||||
*/
|
||||
protected $scene = [
|
||||
'login' => ['account', 'password', 'typeId'],
|
||||
'mobile_login' => ['account', 'code', 'typeId'],
|
||||
'refresh' => [],
|
||||
'send_code' => ['account', 'type'],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user