User.php 941 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * Created by PhpStorm
  4. * User:林志杰
  5. * Email:[email protected]
  6. * Motto:纵有疾风起,人生不言弃!
  7. * Time:2020/1/11 23:40
  8. */
  9. declare(strict_types=1);
  10. namespace app\api\validate;
  11. use think\Validate;
  12. class User extends Validate
  13. {
  14. protected $rule = [
  15. 'username' => 'require',
  16. 'phoneNumber' => 'require',
  17. 'code' => 'require|number|min:4',
  18. 'type' => 'require|in:1,2',
  19. ];
  20. protected $message = [
  21. 'username' => '用户名必须',
  22. 'phoneNumber' => '电话号码必须',
  23. 'code.require' => '短信验证码必须',
  24. 'code.number' => '短信验证码为数字',
  25. 'code.min' => '短信验证码长度不得低于4',
  26. 'type.require' => '类型必须',
  27. 'type.in' => '类型数值错误',
  28. ];
  29. protected $scene = [
  30. 'send_code' => ['phoneNumber'],
  31. 'login' => ['phoneNumber', 'code', 'type'],
  32. ];
  33. }