Presell.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\common\validate;
  3. use think\Validate;
  4. /**
  5. * ============================================================================
  6. * DSMall多用户商城
  7. * ============================================================================
  8. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  9. * 网站地址: http://www.csdeshang.com
  10. * ----------------------------------------------------------------------------
  11. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  12. * 不允许对程序代码以任何形式任何目的的再发布。
  13. * ============================================================================
  14. * 验证器
  15. */
  16. class Presell extends Validate
  17. {
  18. protected $rule = [
  19. 'presell_type'=>'require|in:1,2',
  20. 'goods_id'=>'require',
  21. 'presell_deposit_amount'=>'requireIf:presell_type,2|float',
  22. 'presell_price'=>'require|float|gt:0',
  23. 'presell_start_time'=>'require',
  24. 'presell_end_time'=>'require',
  25. 'presell_shipping_time'=>'requireIf:presell_type,1',
  26. ];
  27. protected $message = [
  28. 'presell_type.require' => '请选择预售类型',
  29. 'presell_type.in' => '预售类型错误',
  30. 'goods_id.require' => '请选择预售商品',
  31. 'presell_deposit_amount.requireIf' => '请填写定金',
  32. 'presell_deposit_amount.float' => '定金错误',
  33. 'presell_price.require' => '请填写预售价',
  34. 'presell_price.float' => '预售价错误',
  35. 'presell_price.gt' => '预售价错误',
  36. 'presell_start_time.require' => '请选择开始时间',
  37. 'presell_end_time.require' => '请选择结束时间',
  38. 'presell_shipping_time.requireIf' => '请选择发货时间',
  39. ];
  40. protected $scene = [
  41. 'presell_add' => ['presell_type', 'goods_id', 'presell_deposit_amount', 'presell_price', 'presell_start_time', 'presell_end_time', 'presell_shipping_time'],
  42. 'presell_edit' => ['presell_deposit_amount', 'presell_price', 'presell_shipping_time'],
  43. ];
  44. }