|
@@ -452,12 +452,14 @@ class cartControl extends mobileControl
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public function do_edit($cart_id,$quantity)
|
|
|
+ public function do_edit($cart_id,$quantity_in)
|
|
|
{
|
|
|
$model_cart = Model('cart');
|
|
|
$model_goods= Model('goods');
|
|
|
$logic_buy_1 = logic('buy_1');
|
|
|
|
|
|
+ $quantity = $quantity_in;
|
|
|
+
|
|
|
//存放返回信息
|
|
|
$cart_info = $model_cart->getCartInfo(array('cart_id'=>$cart_id,'buyer_id'=>$_SESSION['member_id']));
|
|
|
if ($cart_info['bl_id'] == '0')
|
|
@@ -477,8 +479,10 @@ class cartControl extends mobileControl
|
|
|
$logic_buy_1->getGroupbuyInfo($goods_info);
|
|
|
//限时折扣
|
|
|
$logic_buy_1->getXianshiInfo($goods_info,$quantity);
|
|
|
-
|
|
|
$quantity = $goods_info['goods_num'];
|
|
|
+ if($quantity == $cart_info['goods_num']) {
|
|
|
+ return array('cart_id' => $cart_id, 'quantity' => $quantity, 'err_info' => "该商品只允许抢购{$quantity}件~");
|
|
|
+ }
|
|
|
if(intval($goods_info['goods_storage']) < $quantity) {
|
|
|
$model_cart->editCart(array('goods_num'=>$goods_info['goods_storage']),array('cart_id'=>$cart_id,'buyer_id'=>$_SESSION['member_id']));
|
|
|
return array('cart_id' => $cart_id, 'quantity' => $goods_info['goods_storage'], 'err_info' => '库存不足,已将您购物车更新为库存数量.');
|