mirror of
https://github.com/v2board/v2board.git
synced 2024-11-10 09:39:10 +08:00
update: stat user view api
This commit is contained in:
parent
550e628972
commit
10bf65a5f9
@ -4,6 +4,7 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\ServerShadowsocks;
|
||||
use App\Models\ServerTrojan;
|
||||
use App\Models\StatUser;
|
||||
use App\Services\ServerService;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
@ -123,5 +124,23 @@ class StatController extends Controller
|
||||
'data' => $statistics
|
||||
]);
|
||||
}
|
||||
|
||||
public function getStatUser(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'user_id' => 'required|integer'
|
||||
]);
|
||||
$current = $request->input('current') ? $request->input('current') : 1;
|
||||
$pageSize = $request->input('pageSize') >= 10 ? $request->input('pageSize') : 10;
|
||||
$builder = StatUser::orderBy('record_at', 'DESC')->where('user_id', $request->input('user_id'));
|
||||
|
||||
$total = $builder->count();
|
||||
$records = $builder->forPage($current, $pageSize)
|
||||
->get();
|
||||
return [
|
||||
'data' => $records,
|
||||
'total' => $total
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,6 +82,7 @@ class AdminRoute
|
||||
$router->get ('/stat/getOverride', 'Admin\\StatController@getOverride');
|
||||
$router->get ('/stat/getServerLastRank', 'Admin\\StatController@getServerLastRank');
|
||||
$router->get ('/stat/getOrder', 'Admin\\StatController@getOrder');
|
||||
$router->get ('/stat/getStatUser', 'Admin\\StatController@getStatUser');
|
||||
// Notice
|
||||
$router->get ('/notice/fetch', 'Admin\\NoticeController@fetch');
|
||||
$router->post('/notice/save', 'Admin\\NoticeController@save');
|
||||
|
Loading…
Reference in New Issue
Block a user