Kirin 2 年之前
父节点
当前提交
279440baa6
共有 1 个文件被更改,包括 7 次插入7 次删除
  1. 7 7
      app/models/store/StoreCart.php

+ 7 - 7
app/models/store/StoreCart.php

@@ -98,18 +98,18 @@ class StoreCart extends BaseModel
         } else {
 
             $stock = 0;
-            if ($cart['bargain_id']) {
+            if ($bargain_id) {
                 //TODO 获取砍价产品的库存
-                $stock = StoreBargain::getBargainStock($cart['bargain_id']);
-            } else if ($cart['seckill_id']) {
+                $stock = StoreBargain::getBargainStock($bargain_id);
+            } else if ($seckill_id) {
                 //TODO 获取秒杀产品的库存
-                $stock = StoreSeckill::getProductStock($cart['seckill_id']);
-            } else if ($cart['combination_id']) {
+                $stock = StoreSeckill::getProductStock($seckill_id);
+            } else if ($combination_id) {
                 //TODO 获取拼团产品的库存
-                $stock = StoreCombination::getCombinationStock($cart['combination_id'], $cart_num);
+                $stock = StoreCombination::getCombinationStock($combination_id, $cart_num);
             } else if ($cart['product_id']) {
                 //TODO 获取普通产品的库存
-                $stock = StoreProduct::getProductStock($cart['product_id'], $cart['product_attr_unique']);
+                $stock = StoreProduct::getProductStock($product_id, $product_attr_unique);
             }
             if (!$stock) return self::setErrorInfo('暂无库存');
             if (!$cart_num) return self::setErrorInfo('库存错误');