| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Module\User\Validator;
- use UCore\Validator\ConsumeErrorValidator;
- use UCore\Validator\PrepareValidator;
- /**
- * 手机登录限制
- *
- */
- class PhoneContinuousTimes extends \App\Module\Sys\Validator\ContinuousTimes implements ConsumeErrorValidator,PrepareValidator
- {
- protected $times = 5;
- public function validate(mixed $value, array $data): bool
- {
- $res= $this->checkValidate();
- if($res !== true){
- // 不通过
- // 进行封禁
- LoginJizhi::add4Class(0,$value);
- }
- return $res;
- }
- public function prepare()
- {
- $this->type = $this->validation->getName();
- $this->sid = $this->validation->get('phone');
- }
- public function consumeError()
- {
- return $this->add();
- }
- }
|