ShippingTemplatesValidate.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\adminapi\validate\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. 'type' => 'number',
  26. 'appoint' => 'number',
  27. 'sort' => 'number'
  28. ];
  29. /**
  30. * 定义错误信息
  31. * 格式:'字段名.规则名' => '错误信息'
  32. *
  33. * @var array
  34. */
  35. protected $message = [
  36. 'name.require' => '请填写运费模板名称',
  37. 'region_info.array' => '运费信息必须为数组',
  38. 'appoint_info.array' => '包邮信息必须为数组',
  39. 'type.number' => 'type数据格式错误,应为1或2或3',
  40. 'appoint.number' => 'appoint数据格式错误,应为0或1',
  41. 'sort.number' => 'sort数据格式错误,应为整数',
  42. ];
  43. protected $scene = [
  44. 'save' => ['name', 'type', 'appoint', 'sort', 'region_info', 'appoint_info'],
  45. ];
  46. }