|
@@ -389,6 +389,24 @@ class StoreOrderCreateServices extends BaseServices
|
|
|
$advanceServices = app()->make(StoreAdvanceServices::class);
|
|
$advanceServices = app()->make(StoreAdvanceServices::class);
|
|
|
try {
|
|
try {
|
|
|
foreach ($cartInfo as $cart) {
|
|
foreach ($cartInfo as $cart) {
|
|
|
|
|
+ $productId = $cart['productInfo']['id'] ?? 0;
|
|
|
|
|
+ $productName = $cart['productInfo']['store_name'] ?? '';
|
|
|
|
|
+ $cartNum = (int)$cart['cart_num'];
|
|
|
|
|
+ $attrUnique = isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '';
|
|
|
|
|
+ $attrSuk = isset($cart['productInfo']['attrInfo']) ? ($cart['productInfo']['attrInfo']['suk'] ?? '') : '';
|
|
|
|
|
+
|
|
|
|
|
+ @file_put_contents("qunju.txt", json_encode([
|
|
|
|
|
+ 'product_id' => $productId,
|
|
|
|
|
+ 'product_name' => $productName,
|
|
|
|
|
+ 'cart_num' => $cartNum,
|
|
|
|
|
+ 'attr_unique' => $attrUnique,
|
|
|
|
|
+ 'attr_suk' => $attrSuk,
|
|
|
|
|
+ 'combinationId' => $combinationId,
|
|
|
|
|
+ 'seckillId' => $seckillId,
|
|
|
|
|
+ 'bargainId' => $bargainId,
|
|
|
|
|
+ 'advanceId' => $advanceId
|
|
|
|
|
+ ])."-扣库存商品信息\r\n", 8);
|
|
|
|
|
+
|
|
|
//减库存加销量
|
|
//减库存加销量
|
|
|
if ($combinationId) $res5 = $res5 && $pinkServices->decCombinationStock((int)$cart['cart_num'], $combinationId, isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
if ($combinationId) $res5 = $res5 && $pinkServices->decCombinationStock((int)$cart['cart_num'], $combinationId, isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
|
else if ($seckillId) $res5 = $res5 && $seckillServices->decSeckillStock((int)$cart['cart_num'], $seckillId, isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
else if ($seckillId) $res5 = $res5 && $seckillServices->decSeckillStock((int)$cart['cart_num'], $seckillId, isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
@@ -397,9 +415,12 @@ class StoreOrderCreateServices extends BaseServices
|
|
|
else $res5 = $res5 && $services->decProductStock((int)$cart['cart_num'], (int)$cart['productInfo']['id'], isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
else $res5 = $res5 && $services->decProductStock((int)$cart['cart_num'], (int)$cart['productInfo']['id'], isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
|
}
|
|
}
|
|
|
if (!$res5) {
|
|
if (!$res5) {
|
|
|
|
|
+ @file_put_contents("qunju.txt", "扣库存失败: res5=false\r\n", 8);
|
|
|
throw new ApiException(410238);
|
|
throw new ApiException(410238);
|
|
|
}
|
|
}
|
|
|
} catch (\Throwable $e) {
|
|
} catch (\Throwable $e) {
|
|
|
|
|
+ @file_put_contents("qunju.txt", "扣库存异常: ".$e->getMessage()."\r\n", 8);
|
|
|
|
|
+ @file_put_contents("qunju.txt", "扣库存异常文件: ".$e->getFile()." 行号: ".$e->getLine()."\r\n", 8);
|
|
|
throw new ApiException(410238);
|
|
throw new ApiException(410238);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|