From 5630066aa46fcf7bf8fc56bc12ea3f82c52eb069 Mon Sep 17 00:00:00 2001 From: Tokumeikoi Date: Mon, 4 May 2020 16:44:40 +0800 Subject: [PATCH] order process fix --- app/Services/OrderService.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index 645eca2c..7803f846 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -130,7 +130,9 @@ class OrderService $totalValue = $orderModel->sum('total_amount') + $orderModel->sum('balance_amount'); $totalMonth = 0; foreach ($orderModel->get() as $item) { - $totalMonth = $totalMonth + $strToMonth[$item->cycle]; + $surplusMonth = strtotime("+ {$strToMonth[$item->cycle]}month", $item->updated_at); + $surplusMonth = ($surplusMonth - time()) / 2678400; + $totalMonth = $totalMonth + $surplusMonth; } if (!$totalValue || !$totalMonth) { return;