2026-03-21 02:55:24 +08:00
|
|
|
<?php
|
|
|
|
|
// +----------------------------------------------------------------------
|
2026-03-29 11:22:52 +08:00
|
|
|
// | Author: ScottPan Team
|
2026-03-21 02:55:24 +08:00
|
|
|
// +----------------------------------------------------------------------
|
2026-03-29 11:22:52 +08:00
|
|
|
|
2026-03-21 02:55:24 +08:00
|
|
|
namespace app\validate\api\user;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use think\Validate;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 注册验证
|
|
|
|
|
* Class RegisterValidates
|
|
|
|
|
* @package app\http\validates\api\user
|
|
|
|
|
*/
|
|
|
|
|
class RegisterValidates extends Validate
|
|
|
|
|
{
|
|
|
|
|
protected $regex = ['phone' => '/^1[3456789]\d{9}$/'];
|
|
|
|
|
|
|
|
|
|
protected $rule = [
|
|
|
|
|
'phone' => 'require|regex:phone',
|
|
|
|
|
'account' => 'require|regex:phone',
|
|
|
|
|
'password' => 'require',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
protected $message = [
|
|
|
|
|
'phone.require' => '手机号必须填写',
|
|
|
|
|
'phone.regex' => '手机号格式错误',
|
|
|
|
|
'account.require' => '手机号必须填写',
|
|
|
|
|
'account.regex' => '手机号格式错误',
|
|
|
|
|
'captcha.require' => '验证码必须填写',
|
|
|
|
|
'captcha.length' => '验证码长度不正确',
|
|
|
|
|
'password.require' => '密码必须填写',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function sceneCode()
|
|
|
|
|
{
|
|
|
|
|
return $this->only(['phone']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function sceneRegister()
|
|
|
|
|
{
|
|
|
|
|
return $this->only(['account', 'captcha', 'password']);
|
|
|
|
|
}
|
|
|
|
|
}
|