| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Module\User\Validation;
- use App\Module\Common\Validator\Phone;
- use App\Module\Ulogic\Validator\Model2Unit;
- use App\Module\User\Validator\UsernameNt;
- use UCore\ValidationCore;
- use App\Module\User\Validator\CanLogin;
- use App\Module\User\Validator\Username;
- /**
- * 注册验证器
- *
- */
- class Register extends ValidationCore
- {
- /**
- * @var \App\Module\Ulogic\Unit\User
- */
- public $userLogic;
- /**
- * 用户模型
- * @var \App\Module\User\Unit\User
- */
- public $user;
- public function rules($rules = []): array
- {
- return [
- [
- 'username,password,password2', 'required'
- ],
- [
- 'username',
- new UsernameNt($this),
- 'msg' => '用户名重复'
- ],
- [
- 'username',new Phone($this),
- 'msg'=>'手机号码不正确'
- ],
- [
- 'username','alphaNum',
- 'msg'=>'用户名只能包含字母和数字'
- ],
- [
- 'password', 'eqField', 'password2',
- 'msg' => '两次密码不一致'
- ]
- ];
- }
- }
|