|
@@ -13,6 +13,8 @@ class Cart extends Validate
|
|
|
'goods_id' => 'require|integer|gt:0',
|
|
|
'goods_sku_id' => 'integer|egt:0',
|
|
|
'nums' => 'require|integer|gt:0',
|
|
|
+ 'cartIds' => 'require|array|min:1',
|
|
|
+ 'isChecked' => 'require|in:0,1',
|
|
|
];
|
|
|
|
|
|
/**
|
|
@@ -27,6 +29,11 @@ class Cart extends Validate
|
|
|
'nums.require' => '商品数量不能为空',
|
|
|
'nums.integer' => '商品数量必须是整数',
|
|
|
'nums.gt' => '商品数量必须大于0',
|
|
|
+ 'cartIds.require' => '购物车ID不能为空',
|
|
|
+ 'cartIds.array' => '购物车ID必须为数组',
|
|
|
+ 'cartIds.min' => '至少选择一个购物车项',
|
|
|
+ 'isChecked.require' => '选中状态不能为空',
|
|
|
+ 'isChecked.in' => '选中状态只能是0或1',
|
|
|
];
|
|
|
|
|
|
/**
|
|
@@ -35,5 +42,6 @@ class Cart extends Validate
|
|
|
protected $scene = [
|
|
|
'add' => ['goods_id', 'goods_sku_id', 'nums'],
|
|
|
'set_nums' => ['nums'],
|
|
|
+ 'checked' => ['cartIds', 'isChecked'],
|
|
|
];
|
|
|
}
|