From dae5d2a2a3ce985d101eee669fd9358418843cfa Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Sat, 2 May 2020 14:29:04 +0800 Subject: [PATCH] update --- app/Services/OrderService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 4b667fbf..645eca2c 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -128,13 +128,13 @@ class OrderService ->where('status', 3); $totalValue = $orderModel->sum('total_amount') + $orderModel->sum('balance_amount'); - if ($totalValue <= 0) { - return; - } $totalMonth = 0; foreach ($orderModel->get() as $item) { $totalMonth = $totalMonth + $strToMonth[$item->cycle]; } + if (!$totalValue || !$totalMonth) { + return; + } $unitPrice = $totalValue / $totalMonth; $remainingMonth = ($user->expired_at - time()) / 2678400; $result = $unitPrice * $remainingMonth;