|
|
@@ -481,6 +481,8 @@ class StoreOrder extends BaseModel
|
|
|
//生成门店订单信息
|
|
|
self::createOrderPart($orderInfo); //拆单创建门店订单表
|
|
|
$res5 = true;
|
|
|
+ @file_put_contents('quanju.txt', "-报错点1\r\n", 8);
|
|
|
+
|
|
|
foreach ($cartInfo as $cart) {
|
|
|
//减库存加销量
|
|
|
if ($combinationId) $res5 = $res5 && StoreCombination::decCombinationStock($cart['cart_num'], $combinationId, isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
|
@@ -488,14 +490,24 @@ class StoreOrder extends BaseModel
|
|
|
else if ($bargain_id) $res5 = $res5 && StoreBargain::decBargainStock($cart['cart_num'], $bargain_id, isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
|
else $res5 = $res5 && StoreProduct::decProductStock($cart['cart_num'], $cart['productInfo']['id'], isset($cart['productInfo']['attrInfo']) ? $cart['productInfo']['attrInfo']['unique'] : '');
|
|
|
}
|
|
|
+ @file_put_contents('quanju.txt', "-报错点2\r\n", 8);
|
|
|
+
|
|
|
//保存购物车商品信息
|
|
|
$res4 = false !== StoreOrderCartInfo::setCartInfo($order['id'], $cartInfo);
|
|
|
+ @file_put_contents('quanju.txt', "-报错点3\r\n", 8);
|
|
|
+
|
|
|
//购物车状态修改
|
|
|
$res6 = false !== StoreCart::where('id', 'IN', $cartIds)->update(['is_pay' => 1]);
|
|
|
if (!$res4 || !$res5 || !$res6) return self::setErrorInfo('订单生成失败!', true);
|
|
|
+ @file_put_contents('quanju.txt', "-报错点4\r\n", 8);
|
|
|
+
|
|
|
//自动设置默认地址
|
|
|
UserRepository::storeProductOrderCreateEbApi($order, compact('cartInfo', 'addressId'));
|
|
|
+ @file_put_contents('quanju.txt', "-报错点5\r\n", 8);
|
|
|
+
|
|
|
self::clearCacheOrderInfo($uid, $key);
|
|
|
+ @file_put_contents('quanju.txt', "-报错点6\r\n", 8);
|
|
|
+
|
|
|
self::commitTrans();
|
|
|
StoreOrderStatus::status($order['id'], 'cache_key_create_order', '订单生成');
|
|
|
return $order;
|
|
|
@@ -512,8 +524,6 @@ class StoreOrder extends BaseModel
|
|
|
|
|
|
public static function createOrderPart($orderInfo)
|
|
|
{
|
|
|
- @file_put_contents('quanju.txt', json_encode($orderInfo['cart_id']) . "-报错的购物车id\r\n", 8);
|
|
|
-
|
|
|
$user_info = User::where('uid', $orderInfo['uid'])->find();
|
|
|
// $cart_ids = explode(',', $orderInfo['cart_id']);
|
|
|
$cart_ids = $orderInfo['cart_id'];
|