From 1d15f8eb03791dcd6a8465748836c8a3b7b7dbfd Mon Sep 17 00:00:00 2001 From: root Date: Mon, 23 Dec 2019 15:33:34 +0800 Subject: [PATCH] update --- app/Http/Controllers/UserController.php | 16 ++++++++++++++++ routes/api.php | 1 + 2 files changed, 17 insertions(+) diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index d555c000..37064528 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -87,6 +87,22 @@ class UserController extends Controller ]); } + public function getStat (Request $request) { + $stat = [ + Order::where('status', 0) + ->where('user_id', $request->session()->get('id')) + ->count(), + Ticket::where('status', 0) + ->where('user_id', $request->session()->get('id')) + ->count(), + User::where('invite_user_id', $request->session()->get('id')) + ->count() + ]; + return response([ + 'data' => $stat + ]); + } + public function getSubscribe (Request $request) { $user = User::find($request->session()->get('id')); $server = []; diff --git a/routes/api.php b/routes/api.php index 71416d1d..61d24feb 100755 --- a/routes/api.php +++ b/routes/api.php @@ -68,6 +68,7 @@ Route::prefix('v1') Route::post('changePassword', 'UserController@changePassword'); Route::post('update', 'UserController@update'); Route::get ('getSubscribe', 'UserController@getSubscribe'); + Route::get ('getStat', 'UserController@getStat'); // Order Route::get ('order', 'OrderController@index'); Route::post('order/save', 'OrderController@save');