ShippingTemplatesValidate.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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\setting;
  12. use think\Validate;
  13. class ShippingTemplatesValidate extends Validate
  14. {
  15. /**
  16. * 定义验证规则
  17. * 格式:'字段名' => ['规则1','规则2'...]
  18. *
  19. * @var array
  20. */
  21. protected $rule = [
  22. 'name' => 'require',
  23. 'region_info' => 'array',
  24. 'appoint_info' => 'array',
  25. 'no_delivery_info' => 'array',
  26. 'type' => 'number',
  27. 'appoint' => 'number',
  28. 'no_delivery' => 'number',
  29. 'sort' => 'number'
  30. ];
  31. /**
  32. * 定义错误信息
  33. * 格式:'字段名.规则名' => '错误信息'
  34. *
  35. * @var array
  36. */
  37. protected $message = [
  38. 'name.require' => '请填写运费模板名称',
  39. 'region_info.array' => '运费信息必须为数组',
  40. 'appoint_info.array' => '包邮信息必须为数组',
  41. 'no_delivery_info.array' => '不送达信息必须为数组',
  42. 'type.number' => 'type数据格式错误,应为1或2或3',
  43. 'appoint.number' => 'appoint数据格式错误,应为0或1',
  44. 'no_delivery.number' => 'no_delivery数据格式错误,应为0或1',
  45. 'sort.number' => 'sort数据格式错误,应为整数',
  46. ];
  47. protected $scene = [
  48. 'save' => ['name', 'type', 'appoint', 'sort', 'region_info', 'appoint_info', 'no_delivery_info', 'no_delivery'],
  49. ];
  50. }