2022-03-05 00:27:43 +08:00
|
|
|
<?php
|
|
|
|
|
2023-05-24 11:35:27 +08:00
|
|
|
namespace App\Http\Controllers\User;
|
2022-03-05 00:27:43 +08:00
|
|
|
|
2023-05-24 11:35:27 +08:00
|
|
|
use App\Http\Controllers\Controller;
|
2022-03-05 00:27:43 +08:00
|
|
|
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'
|
2022-03-05 00:27:43 +08:00
|
|
|
])
|
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()
|
2022-03-05 00:27:43 +08:00
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|