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');