v2board/app/Http/Controllers/User/StatController.php

29 lines
675 B
PHP
Raw Normal View History

<?php
2023-05-24 11:35:27 +08:00
namespace App\Http\Controllers\User;
2023-05-24 11:35:27 +08:00
use App\Http\Controllers\Controller;
use App\Models\StatUser;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class StatController extends Controller
{
2023-05-24 11:35:27 +08:00
public function getTrafficLog(Request $request)
2023-05-20 20:50:53 +08:00
{
2023-05-24 11:35:27 +08:00
$builder = StatUser::select([
2022-03-29 20:45:54 +08:00
'u',
'd',
2023-05-24 11:35:27 +08:00
'record_at',
'user_id',
'server_rate'
])
2023-05-24 11:35:27 +08:00
->where('user_id', $request->user['id'])
->where('record_at', '>=', strtotime(date('Y-m-1')))
->orderBy('record_at', 'DESC');
return response([
'data' => $builder->get()
]);
}
}