ShippingTemplatesValidate.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\adminapi\validates\setting;
  3. use think\Validate;
  4. class ShippingTemplatesValidate extends Validate
  5. {
  6. /**
  7. * 定义验证规则
  8. * 格式:'字段名' => ['规则1','规则2'...]
  9. *
  10. * @var array
  11. */
  12. protected $rule = [
  13. 'name' => 'require',
  14. 'region_info' => 'array',
  15. 'appoint_info' => 'array',
  16. 'type' => 'number',
  17. 'appoint' => 'number',
  18. 'sort' => 'number'
  19. ];
  20. /**
  21. * 定义错误信息
  22. * 格式:'字段名.规则名' => '错误信息'
  23. *
  24. * @var array
  25. */
  26. protected $message = [
  27. 'name.require' => '请填写运费模板名称',
  28. 'region_info.array' => '运费信息必须为数组',
  29. 'appoint_info.array' => '包邮信息必须为数组',
  30. 'type.number' => 'type数据格式错误,应为1或2或3',
  31. 'appoint.number' => 'appoint数据格式错误,应为0或1',
  32. 'sort.number' => 'sort数据格式错误,应为整数',
  33. ];
  34. protected $scene = [
  35. 'save' => ['name', 'type', 'appoint', 'sort', 'region_info', 'appoint_info'],
  36. ];
  37. }