ShopCartValidate.php 821 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. namespace app\workerapi\validate\shops;
  3. use app\common\validate\BaseValidate;
  4. class ShopCartValidate extends BaseValidate
  5. {
  6. protected $rule = [
  7. 'shop_goods_id' => 'require',
  8. 'goods_specs_inventory_id' => 'require',
  9. 'number' => 'require|min:1',
  10. 'ids' => 'require|array',
  11. ];
  12. protected $field = [
  13. 'shop_goods_id' => '商品id',
  14. 'goods_specs_inventory_id' => '规格ID',
  15. 'number' => '数量',
  16. ];
  17. public function sceneAdd()
  18. {
  19. return $this->only(['shop_goods_id', 'goods_specs_inventory_id', 'number']);
  20. }
  21. /**
  22. * @notes 删除场景
  23. * @return ShopGoodsValidate
  24. * @author likeadmin
  25. * @date 2024/08/04 11:07
  26. */
  27. public function sceneDelete()
  28. {
  29. return $this->only(['ids']);
  30. }
  31. }