Voucher.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 验证器
  14. */
  15. class Voucher extends Validate
  16. {
  17. protected $rule = [
  18. 'promotion_voucher_price'=>'require|number',
  19. 'promotion_voucher_storetimes_limit'=>'require|number',
  20. 'promotion_voucher_buyertimes_limit'=>'require|number|elt:100',
  21. 'voucher_price'=>'require',
  22. 'voucher_price_describe'=>'require',
  23. 'voucher_points'=>'require',
  24. 'vouchertemplate_title'=>'require|length:1,50',
  25. 'vouchertemplate_total'=>'require|number',
  26. 'vouchertemplate_price'=>'require|number',
  27. 'vouchertemplate_limit'=>'require',
  28. 'vouchertemplate_desc'=>'require|length:1,255'
  29. ];
  30. protected $message = [
  31. 'promotion_voucher_price.require'=>'购买单价应为大于0的整数',
  32. 'promotion_voucher_price.number'=>'购买单价应为大于0的整数',
  33. 'promotion_voucher_storetimes_limit.require'=>'每月活动数量应为大于0的整数',
  34. 'promotion_voucher_storetimes_limit.number'=>'每月活动数量应为大于0的整数',
  35. 'promotion_voucher_buyertimes_limit.require'=>'最大领取数量应为大于0小于100的整数',
  36. 'promotion_voucher_buyertimes_limit.number'=>'最大领取数量应为大于0小于100的整数',
  37. 'promotion_voucher_buyertimes_limit.elt'=>'最大领取数量应为大于0小于100的整数',
  38. 'voucher_price.require'=>'代金券面额应为大于0的整数',
  39. 'voucher_price_describe.require'=>'描述不能为空',
  40. 'voucher_points.require'=>'默认兑换积分数应为大于0的整数',
  41. 'vouchertemplate_title.require'=>'模版名称不能为空且不能大于50个字符',
  42. 'vouchertemplate_title.length'=>'模版名称不能为空且不能大于50个字符',
  43. 'vouchertemplate_total.require'=>'可发放数量不能为空且必须为整数',
  44. 'vouchertemplate_total.number'=>'可发放数量不能为空且必须为整数',
  45. 'vouchertemplate_price.require'=>'模版面额不能为空且必须为整数,且面额不能大于限额',
  46. 'vouchertemplate_price.number'=>'模版面额不能为空且必须为整数,且面额不能大于限额',
  47. 'vouchertemplate_limit.require'=>'模版使用消费限额不能为空且必须是数字',
  48. 'vouchertemplate_desc.require'=>'模版描述不能为空且不能大于255个字符',
  49. 'vouchertemplate_desc.length'=>'模版描述不能为空且不能大于255个字符'
  50. ];
  51. protected $scene = [
  52. 'setting' => ['promotion_voucher_price', 'promotion_voucher_storetimes_limit', 'promotion_voucher_buyertimes_limit'],
  53. 'priceadd' => ['voucher_price', 'voucher_price_describe', 'voucher_points'],
  54. 'priceedit' => ['voucher_price', 'voucher_price_describe', 'voucher_points'],
  55. 'templateadd' => ['vouchertemplate_title', 'vouchertemplate_total', 'vouchertemplate_price', 'vouchertemplate_limit', 'vouchertemplate_desc'],
  56. 'templateedit' => ['vouchertemplate_title', 'vouchertemplate_total', 'vouchertemplate_price', 'vouchertemplate_limit', 'vouchertemplate_desc'],
  57. ];
  58. }