UserAuthValidate.php 749 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020/5/28
  7. *
  8. *
  9. */
  10. namespace app\validate\api;
  11. use think\Validate;
  12. class UserAuthValidate extends Validate
  13. {
  14. protected $failException = true;
  15. protected $rule = [
  16. // 'phone|手机号' => 'require|mobile',
  17. 'pwd|密码' => 'require|min:6',
  18. 'sms_code|短信验证码' => 'require|max:4',
  19. ];
  20. public function scenePwdlogin()
  21. {
  22. return $this->remove('sms_code','require|max:4');
  23. }
  24. public function sceneSmslogin()
  25. {
  26. return $this->remove('pwd','require|min:6');
  27. }
  28. public function sceneVerify()
  29. {
  30. return $this->remove('pwd','require|min:6')
  31. ->remove('sms_code','require|max:4');
  32. }
  33. }