AddressValidate.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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\api\user;
  12. use think\Validate;
  13. /**
  14. * 用户地址验证类
  15. * Class AddressValidate
  16. * @package app\validate\api\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' => '名称必须填写',
  32. 'real_name.max' => '名称最多不能超过25个字符',
  33. 'phone.require' => '手机号必须填写',
  34. 'phone.regex' => '手机号格式错误',
  35. 'province.require' => '省必须填写',
  36. 'city.require' => '市名称必须填写',
  37. 'district.require' => '区/县名称必须填写',
  38. 'detail.require' => '详细地址必须填写',
  39. ];
  40. }