ServeValidate.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\validate\admin\serve;
  12. use think\Validate;
  13. class ServeValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'phone' => 'require|number|mobile',
  23. 'password' => 'require',
  24. 'verify_code' => 'require|number',
  25. 'account' => 'require',
  26. ];
  27. /**
  28. * 定义错误信息
  29. * 格式:'字段名.规则名' => '错误信息'
  30. *
  31. * @var array
  32. */
  33. protected $message = [
  34. 'phone.require' => '请填写手机号码',
  35. 'phone.number' => '您输入的手机号码必须为数字',
  36. 'phone.mobile' => '您输入的手机号码有误',
  37. 'password.require' => '密码必须填写',
  38. 'verify_code.require' => '请填写短信验证码',
  39. 'verify_code.number' => '短信验证码必须为数字',
  40. 'account.require' => '请填写账号',
  41. ];
  42. protected $scene = [
  43. 'login' => ['password', 'account'],
  44. 'phone' => ['phone']
  45. ];
  46. }