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