Sellervoucher.php 1.8 KB

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