浏览代码

order process fix

Tokumeikoi 4 年之前
父节点
当前提交
5630066aa4
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      app/Services/OrderService.php

+ 3 - 1
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;