PhoneContinuousTimes.php 819 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Module\User\Validator;
  3. use UCore\Validator\ConsumeErrorValidator;
  4. use UCore\Validator\PrepareValidator;
  5. /**
  6. * 手机登录限制
  7. *
  8. */
  9. class PhoneContinuousTimes extends \App\Module\Sys\Validator\ContinuousTimes implements ConsumeErrorValidator,PrepareValidator
  10. {
  11. protected $times = 5;
  12. public function validate(mixed $value, array $data): bool
  13. {
  14. $res= $this->checkValidate();
  15. if($res !== true){
  16. // 不通过
  17. // 进行封禁
  18. LoginJizhi::add4Class(0,$value);
  19. }
  20. return $res;
  21. }
  22. public function prepare()
  23. {
  24. $this->type = $this->validation->getName();
  25. $this->sid = $this->validation->get('phone');
  26. }
  27. public function consumeError()
  28. {
  29. return $this->add();
  30. }
  31. }