From e58bc41af7ebc049c21306854a9118044d12997b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Thu, 14 Apr 2022 11:54:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E9=87=91=E9=A2=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/OrderService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index efc34f46..4b571251 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -817,9 +817,12 @@ class OrderService foreach ($amounts as &$amount) { $i--; + $originalAmount = $amount; + if ($i > 0) { $amount = (int) bcdiv(bcmul($couponAmount, $amount, 0), $totalAmount, 2); $couponAmount -= $amount; + $totalAmount -= $originalAmount; } else { $amount = $couponAmount; }