- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明 Made-with: Cursor
48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ScottPan Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
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']);
|
|
}
|
|
}
|