Checkout.php 843 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. *
  4. * @copyright ©2020 点小铺
  5. * @author hanj
  6. * @link: https://dyuit.com
  7. * Created by VSCode
  8. */
  9. namespace app\api\validate\sharing\order;
  10. use think\Validate;
  11. class Checkout extends Validate
  12. {
  13. /**
  14. * 验证规则
  15. * @var array
  16. */
  17. protected $rule = [
  18. // 商品id
  19. 'goods_id' => [
  20. 'require',
  21. 'number',
  22. 'gt' => 0
  23. ],
  24. // 购买数量
  25. 'goods_num' => [
  26. 'require',
  27. 'number',
  28. 'gt' => 0
  29. ],
  30. // 商品sku_id
  31. 'goods_sku_id' => [
  32. 'require',
  33. ],
  34. ];
  35. /**
  36. * 验证场景
  37. * @var array
  38. */
  39. protected $scene = [
  40. 'buyNow' => ['goods_id', 'goods_num', 'goods_sku_id'],
  41. ];
  42. }