|
|
@@ -524,6 +524,8 @@ 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'];
|
|
|
@@ -538,11 +540,15 @@ class StoreOrder extends BaseModel
|
|
|
return $item;
|
|
|
})
|
|
|
->toArray();
|
|
|
+ @file_put_contents('quanju.txt', "-测试2\r\n", 8);
|
|
|
+
|
|
|
$grouped = array_column($cartInfo, 'ids', 'mer_id');
|
|
|
foreach ($cartInfo as $k => $v) {
|
|
|
$total_num = 0;
|
|
|
$total_price = 0;
|
|
|
$deduction_price = 0;
|
|
|
+ @file_put_contents('quanju.txt', "-测试1\r\n", 8);
|
|
|
+
|
|
|
$cartInfo = StoreCart::where('id', 'in', $v)->select();
|
|
|
foreach ($cartInfo as $cart) {
|
|
|
$price = StoreProduct::where('id', $cart['product_id'])->value('price');
|
|
|
@@ -550,12 +556,15 @@ class StoreOrder extends BaseModel
|
|
|
$total_price = bcadd($total_price, $product_price, 2); //商品总价
|
|
|
$total_num = bcadd($total_num, $cart['cart_num'], 2);
|
|
|
}
|
|
|
+ @file_put_contents('quanju.txt', "-这里吗\r\n", 8);
|
|
|
+
|
|
|
if ($user_info['level'] > 0) { //会员折扣
|
|
|
$discount = SystemUserLevel::where('id', $user_info['level'])->value('discount');
|
|
|
$moto_price = $total_price;
|
|
|
$total_price = bcmul($total_price, bcsub(1, $discount, 2), 2);
|
|
|
$deduction_price = bcsub($moto_price, $total_price, 2); //抵扣金额
|
|
|
}
|
|
|
+ @file_put_contents('quanju.txt', "-测试4\r\n", 8);
|
|
|
|
|
|
$orderInfo = [
|
|
|
'mer_id' => $k,
|
|
|
@@ -573,6 +582,8 @@ class StoreOrder extends BaseModel
|
|
|
'mark' => $orderInfo['mark'],
|
|
|
'add_time' => time(),
|
|
|
];
|
|
|
+ @file_put_contents('quanju.txt', json_encode($orderInfo) . "-咋回事啊\r\n", 8);
|
|
|
+
|
|
|
$order = StoreOrderPart::create($orderInfo);
|
|
|
}
|
|
|
|