CheckPhone.php 721 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Module\Sms\Validation;
  3. use App\Module\User\Validator\IsNotRegister;
  4. use UCore\ValidationCore;
  5. use UCore\Validator\PhoneValidator;
  6. /**
  7. * 注册发送短信验证
  8. */
  9. class CheckPhone extends ValidationCore
  10. {
  11. public function rules($rules = []): array
  12. {
  13. $rules = [
  14. [
  15. 'mobile', 'required'
  16. ],
  17. [
  18. 'mobile',
  19. new PhoneValidator($this),
  20. 'msg' => '不存在的手机号码'
  21. ],
  22. [
  23. 'mobile',
  24. new IsNotRegister($this),
  25. 'msg' => '该手机号已注册'
  26. ]
  27. ];
  28. return parent::rules($rules);
  29. }
  30. }