diff --git a/app/common/repositories/store/order/StoreOrderRepository.php b/app/common/repositories/store/order/StoreOrderRepository.php index d5632846..0fd7f9d7 100644 --- a/app/common/repositories/store/order/StoreOrderRepository.php +++ b/app/common/repositories/store/order/StoreOrderRepository.php @@ -1692,10 +1692,12 @@ class StoreOrderRepository extends BaseRepository } if ($order->pay_type == StoreGroupOrder::PAY_TYPE_CREDIT_BUY && $order->interest) { $order->interest_start_time = $order->interest->start_time; - $days = ceil((time() - strtotime($order->interest->start_time)) / 86400); - $interestMoney = bcmul($order->interest->total_price, $order->interest->rate, 2); - $order->interest_money = bcmul($days, $interestMoney, 2); $order->interest_status = $order->interest->status; + if ($order->interest_status == StoreOrderInterest::STATUS_SETTLED) { + $order->interest_money = $order->interest->interest; + } else { + $order->interest_money = $order->interest->calculateInterest(); + } } $order->takeOrderCount = count($order['takeOrderList']); unset($order['takeOrderList'], $order->interest); @@ -2471,6 +2473,7 @@ class StoreOrderRepository extends BaseRepository if ($result === true) { $groupOrder->interest->status = StoreOrderInterest::STATUS_SETTLED; $groupOrder->interest->settle_time = date('Y-m-d H:i:s'); + $groupOrder->interest->interest = $interest; $groupOrder->interest->save(); /** @var UserBillRepository $userBillRepository */