Presell.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 Presell extends Validate
  16. {
  17. protected $rule = [
  18. 'presell_type'=>'require|in:1,2',
  19. 'goods_id'=>'require',
  20. 'presell_deposit_amount'=>'requireIf:presell_type,2|float',
  21. 'presell_price'=>'require|float|gt:0',
  22. 'presell_start_time'=>'require',
  23. 'presell_end_time'=>'require',
  24. 'presell_shipping_time'=>'requireIf:presell_type,1',
  25. ];
  26. protected $message = [
  27. 'presell_type.require' => '请选择预售类型',
  28. 'presell_type.in' => '预售类型错误',
  29. 'goods_id.require' => '请选择预售商品',
  30. 'presell_deposit_amount.requireIf' => '请填写定金',
  31. 'presell_deposit_amount.float' => '定金错误',
  32. 'presell_price.require' => '请填写预售价',
  33. 'presell_price.float' => '预售价错误',
  34. 'presell_price.gt' => '预售价错误',
  35. 'presell_start_time.require' => '请选择开始时间',
  36. 'presell_end_time.require' => '请选择结束时间',
  37. 'presell_shipping_time.requireIf' => '请选择发货时间',
  38. ];
  39. protected $scene = [
  40. 'presell_add' => ['presell_type', 'goods_id', 'presell_deposit_amount', 'presell_price', 'presell_start_time', 'presell_end_time', 'presell_shipping_time'],
  41. 'presell_edit' => ['presell_deposit_amount', 'presell_price', 'presell_shipping_time'],
  42. ];
  43. }