mirror of
https://github.com/v2board/v2board.git
synced 2025-01-11 00:29:09 +08:00
fix: server rank
This commit is contained in:
parent
0e6f6358d8
commit
ab9c6c85bb
@ -99,12 +99,13 @@ class StatController extends Controller
|
|||||||
'server_id',
|
'server_id',
|
||||||
'server_type',
|
'server_type',
|
||||||
'u',
|
'u',
|
||||||
'd'
|
'd',
|
||||||
|
DB::raw('(u+d) as total')
|
||||||
])
|
])
|
||||||
->where('record_at', '>=', $timestamp)
|
->where('record_at', '>=', $timestamp)
|
||||||
->where('record_type', 'd')
|
->where('record_type', 'd')
|
||||||
->limit(10)
|
->limit(10)
|
||||||
->orderBy('record_at', 'DESC')
|
->orderBy('total', 'DESC')
|
||||||
->get()
|
->get()
|
||||||
->toArray();
|
->toArray();
|
||||||
foreach ($statistics as $k => $v) {
|
foreach ($statistics as $k => $v) {
|
||||||
@ -113,7 +114,7 @@ class StatController extends Controller
|
|||||||
$statistics[$k]['server_name'] = $server['name'];
|
$statistics[$k]['server_name'] = $server['name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$statistics[$k]['total'] = ($v['u'] + $v['d']) / 1073741824;
|
$statistics[$k]['total'] = $statistics[$k]['total'] / 1073741824;
|
||||||
}
|
}
|
||||||
array_multisort(array_column($statistics, 'total'), SORT_DESC, $statistics);
|
array_multisort(array_column($statistics, 'total'), SORT_DESC, $statistics);
|
||||||
return response([
|
return response([
|
||||||
|
Loading…
Reference in New Issue
Block a user