|
|
@@ -123,29 +123,33 @@ class StoreOrderComputedServices extends BaseServices
|
|
|
|
|
|
|
|
|
$hasRepeat=false;
|
|
|
- $Repeat = $productServices->repeatCount($productIds);
|
|
|
+ try {
|
|
|
+ $Repeat = $productServices->repeatCount($productIds);
|
|
|
+ @file_put_contents("quanju.txt", $Repeat."-复购商品数量\r\n", 8);
|
|
|
|
|
|
- @file_put_contents("quanju.txt", $Repeat."-复购商品数量\r\n", 8);
|
|
|
-
|
|
|
- if ($Repeat > 0){
|
|
|
- $hasRepeat = true;
|
|
|
- }
|
|
|
- @file_put_contents("quanju.txt", $hasRepeat."-是否是复购商品\r\n", 8);
|
|
|
+ if ($Repeat > 0){
|
|
|
+ $hasRepeat = true;
|
|
|
+ }
|
|
|
+ @file_put_contents("quanju.txt", $hasRepeat."-是否是复购商品\r\n", 8);
|
|
|
|
|
|
- if ($hasRepeat) {
|
|
|
- // 将所有有会员折扣的商品还原为原价,重新汇总总价
|
|
|
- $newTotalPrice = '0';
|
|
|
- foreach ($cartInfo as &$cartItem) {
|
|
|
- if (isset($cartItem['price_type']) && in_array($cartItem['price_type'], ['level', 'member'])) {
|
|
|
- $cartItem['truePrice'] = $cartItem['sum_price'];
|
|
|
- $cartItem['vip_truePrice'] = 0;
|
|
|
- $cartItem['price_type'] = 'normal';
|
|
|
+ if ($hasRepeat) {
|
|
|
+ // 将所有有会员折扣的商品还原为原价,重新汇总总价
|
|
|
+ $newTotalPrice = '0';
|
|
|
+ foreach ($cartInfo as &$cartItem) {
|
|
|
+ if (isset($cartItem['price_type']) && in_array($cartItem['price_type'], ['level', 'member'])) {
|
|
|
+ $cartItem['truePrice'] = $cartItem['sum_price'];
|
|
|
+ $cartItem['vip_truePrice'] = 0;
|
|
|
+ $cartItem['price_type'] = 'normal';
|
|
|
+ }
|
|
|
+ $newTotalPrice = bcadd($newTotalPrice, bcmul((string)$cartItem['truePrice'], (string)$cartItem['cart_num'], 4), 2);
|
|
|
}
|
|
|
- $newTotalPrice = bcadd($newTotalPrice, bcmul((string)$cartItem['truePrice'], (string)$cartItem['cart_num'], 4), 2);
|
|
|
+ unset($cartItem);
|
|
|
+ $payPrice = (float)$newTotalPrice;
|
|
|
+ $priceGroup['totalPrice'] = $newTotalPrice;
|
|
|
}
|
|
|
- unset($cartItem);
|
|
|
- $payPrice = (float)$newTotalPrice;
|
|
|
- $priceGroup['totalPrice'] = $newTotalPrice;
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ @file_put_contents("quanju.txt", json_encode($e->getMessage())."-报错内容\r\n", 8);
|
|
|
+ throw $e;
|
|
|
}
|
|
|
}
|
|
|
//使用优惠劵
|