...
|
...
|
@@ -191,12 +191,14 @@ class Cart extends Api |
|
|
})
|
|
|
*/
|
|
|
public function editGoodsNum($cart_id,$goods_num){
|
|
|
halt($cart_id);
|
|
|
$cart = $this->model->get($cart_id);
|
|
|
empty($cart) && $this->error(__('购物车信息不存在'));
|
|
|
$goods_num < 1 && $this->error(__('商品数量不能小于1'));
|
|
|
halt($cart['spec']->toArray());
|
|
|
if($cart['goods']['ismake'] == '0' && $cart['spec']['stock_num'] < $goods_num){
|
|
|
// 检查库存
|
|
|
$goods = Goods::get($cart['goods_id'],['spec_rel.spec']);
|
|
|
$goods_sku = $goods->getGoodsSku($cart['spec_sku_id']);
|
|
|
halt($goods_sku);
|
|
|
if($goods['ismake'] == '0' && $goods_sku['stock_num'] < $goods_num){
|
|
|
$this->error(__('商品库存不足'.$goods_num.'件'));
|
|
|
}
|
|
|
$cart->goods_num = $goods_num;
|
...
|
...
|
|