doge 4 часов назад
Родитель
Сommit
65e8f0a34a
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      app/Services/NewUserSummaryService.php

+ 5 - 4
app/Services/NewUserSummaryService.php

@@ -150,9 +150,10 @@ class NewUserSummaryService
         }
 
         $data = [];
-        $cursor = strtotime($startDate);
-        $endTs = strtotime($endDate);
-        while ($cursor <= $endTs) {
+        // 按日期倒序(新 → 旧)
+        $cursor = strtotime($endDate);
+        $startTs = strtotime($startDate);
+        while ($cursor >= $startTs) {
             $d = date('Y-m-d', $cursor);
             $reg = $registerByDay[$d] ?? null;
             $fd = $firstDepositByDay[$d] ?? null;
@@ -180,7 +181,7 @@ class NewUserSummaryService
                 'company_profit' => round($betTotal - $winTotal, 2),
                 'valid_member' => (int)$flow['valid_member'],
             ];
-            $cursor = strtotime('+1 day', $cursor);
+            $cursor = strtotime('-1 day', $cursor);
         }
 
         return [