Sellervoucher.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. *
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 验证器
  13. */
  14. class Sellervoucher extends Validate
  15. {
  16. protected $rule = [
  17. 'txt_template_title' => 'require|length:1,50',
  18. 'txt_template_total' => 'require|number',
  19. 'select_template_price' => 'require|number',
  20. 'txt_template_limit' => 'require',
  21. 'txt_template_describe' => 'require|length:1,255'
  22. ];
  23. protected $message = [
  24. 'txt_template_title.require' => '模版名称不能为空且不能大于50个字符',
  25. 'txt_template_title.length' => '模版名称不能为空且不能大于50个字符',
  26. 'txt_template_total.require' => '可发放数量不能为空且必须为整数',
  27. 'txt_template_total.number' => '可发放数量不能为空且必须为整数',
  28. 'select_template_price.require' => '模版面额不能为空且必须为整数,且面额不能大于限额',
  29. 'select_template_price.number' => '模版面额不能为空且必须为整数,且面额不能大于限额',
  30. 'txt_template_limit.require' => '模版使用消费限额不能为空且必须是数字',
  31. 'txt_template_describe.require' => '模版描述不能为空且不能大于255个字符',
  32. 'txt_template_describe.length' => '模版描述不能为空且不能大于255个字符'
  33. ];
  34. protected $scene = [
  35. 'templateadd' => ['txt_template_title', 'txt_template_total', 'select_template_price', 'txt_template_limit', 'txt_template_describe'],
  36. 'templateedit' => ['txt_template_title', 'txt_template_total', 'select_template_price', 'txt_template_limit', 'txt_template_describe'],
  37. ];
  38. }