AddressValidate.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\api\validate\user;
  12. use think\Validate;
  13. /**
  14. * 用户地址验证类
  15. * Class AddressValidate
  16. * @package app\http\validates\user
  17. */
  18. class AddressValidate extends Validate
  19. {
  20. //移动
  21. protected $regex = ['phone' => '/^1[3456789]\d{9}|([0-9]{3,4}-)?[0-9]{7,8}$/'];
  22. protected $rule = [
  23. 'real_name' => 'require|max:25',
  24. 'phone' => 'require|regex:phone',
  25. 'province' => 'require',
  26. 'city' => 'require',
  27. 'district' => 'require',
  28. 'detail' => 'require',
  29. ];
  30. protected $message = [
  31. 'real_name.require' => '410155',
  32. 'real_name.max' => '410156',
  33. 'phone.require' => '410157',
  34. 'phone.regex' => '410158',
  35. 'province.require' => '410159',
  36. 'city.require' => '410160',
  37. 'district.require' => '410161',
  38. 'detail.require' => '410162',
  39. ];
  40. }