From 55c4ab94a12b4bb49b1883531f806f31013bce9d Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 29 Jun 2023 13:48:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AE=A2=E5=8D=95=E7=BB=93?= =?UTF-8?q?=E7=AE=97=E5=90=8E=E7=9A=84=E5=88=A9=E6=81=AF=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repositories/store/order/StoreOrderRepository.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 */