update: fix get server last rank

This commit is contained in:
tokumeikoi 2022-03-10 11:04:09 +08:00
parent 7f848ccb13
commit 8832fde4fa

View File

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