ShopCartValidate.php 912 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. public function sceneEdit()
  32. {
  33. return $this->only(['id', 'number']);
  34. }
  35. }