mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-23 19:37:35 +08:00
Combine data with node_id in api output, so its all still "one day", and fits vanilla xboard behaviour
This commit is contained in:
@@ -14,9 +14,20 @@ class StatController extends Controller
|
||||
public function getTrafficLog(Request $request)
|
||||
{
|
||||
$startDate = now()->startOfMonth()->timestamp;
|
||||
|
||||
// Aggregate per-node data back to per-day format for backward compatibility
|
||||
$records = StatUser::query()
|
||||
->select([
|
||||
'user_id',
|
||||
'server_rate',
|
||||
'record_at',
|
||||
'record_type',
|
||||
DB::raw('SUM(u) as u'),
|
||||
DB::raw('SUM(d) as d'),
|
||||
])
|
||||
->where('user_id', $request->user()->id)
|
||||
->where('record_at', '>=', $startDate)
|
||||
->groupBy(['user_id', 'server_rate', 'record_at', 'record_type'])
|
||||
->orderBy('record_at', 'DESC')
|
||||
->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user