Browse Source

update: fix get server last rank

tokumeikoi 3 years ago
parent
commit
8832fde4fa
1 changed files with 4 additions and 2 deletions
  1. 4 2
      app/Http/Controllers/Admin/StatController.php

+ 4 - 2
app/Http/Controllers/Admin/StatController.php

@@ -94,7 +94,8 @@ class StatController extends Controller
             'vmess' => ServerV2ray::where('parent_id', null)->get()->toArray(),
             'trojan' => ServerTrojan::where('parent_id', null)->get()->toArray()
         ];
-        $timestamp = strtotime('-1 day', strtotime(date('Y-m-d')));
+        $startAt = strtotime('-1 day', strtotime(date('Y-m-d')));
+        $endAt = strtotime(date('Y-m-d'));
         $statistics = StatServer::select([
                 'server_id',
                 'server_type',
@@ -102,7 +103,8 @@ class StatController extends Controller
                 'd',
                 DB::raw('(u+d) as total')
             ])
-            ->where('record_at', '>=', $timestamp)
+            ->where('record_at', '>=', $startAt)
+            ->where('record_at', '<', $endAt)
             ->where('record_type', 'd')
             ->limit(10)
             ->orderBy('total', 'DESC')