Pbargain.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. *
  6. *
  7. * ----------------------------------------------------------------------------
  8. *
  9. * 验证器
  10. */
  11. class Pbargain extends Validate
  12. {
  13. protected $rule = [
  14. 'bargain_name' => 'require|max:50',
  15. 'bargain_limit' => 'require|integer|egt:0',
  16. 'bargain_time' => 'require|integer|egt:1|elt:48',
  17. 'bargain_floorprice' => 'require|float|gt:0',
  18. 'bargain_total' => 'require|integer|egt:1',
  19. 'bargain_max' => 'require|float|gt:0',
  20. 'bargain_remark' => 'max:50',
  21. 'bargain_begintime' => 'require|date',
  22. 'bargain_endtime' => 'require|date',
  23. ];
  24. protected $message = [
  25. 'bargain_name.require' => '请填写砍价名称',
  26. 'bargain_name.max' => '砍价名称不能超过50个字符',
  27. 'bargain_limit.require' => '请填写砍价限购数量',
  28. 'bargain_limit.integer' => '砍价限购数量必须是整数',
  29. 'bargain_limit.egt' => '砍价限购数量需要大于等于0',
  30. 'bargain_time.require' => '请填写砍价有效期',
  31. 'bargain_time.integer' => '砍价有效期必须是整数',
  32. 'bargain_time.egt' => '砍价有效期需要大于等于1',
  33. 'bargain_time.elt' => '砍价有效期需要小于等于48',
  34. 'bargain_floorprice.require' => '请填写商品底价',
  35. 'bargain_floorprice.float' => '商品底价必须是数字',
  36. 'bargain_floorprice.gt' => '商品底价需要大于0',
  37. 'bargain_total.require' => '请填写底价砍价次数',
  38. 'bargain_total.integer' => '底价砍价次数必须是整数',
  39. 'bargain_total.egt' => '底价砍价次数需要大于等于1',
  40. 'bargain_max.require' => '请填写每刀最多可砍金额',
  41. 'bargain_max.float' => '每刀最多可砍金额必须是数字',
  42. 'bargain_max.gt' => '每刀最多可砍金额需要大于0',
  43. 'bargain_remark.max' => '分享描述不能超过50个字符',
  44. 'bargain_begintime.require' => '请填写开始时间',
  45. 'bargain_begintime.date' => '开始时间错误',
  46. 'bargain_endtime.require' => '请填写结束时间',
  47. 'bargain_endtime.date' => '结束时间错误',
  48. ];
  49. protected $scene = [
  50. 'pbargin_save' => ['bargain_name', 'bargain_limit', 'bargain_time', 'bargain_floorprice', 'bargain_total', 'bargain_max', 'bargain_remark', 'bargain_begintime', 'bargain_endtime'],
  51. ];
  52. }