From 57bd348b9a3684b29791d20067e090ba7a792282 Mon Sep 17 00:00:00 2001 From: tping Date: Tue, 31 Aug 2021 18:24:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9C=AA=E6=88=90=E5=B9=B4=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Common/function.php | 13 +++++++++++++ Application/Sdk/Controller/UserController.class.php | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/Application/Sdk/Common/function.php b/Application/Sdk/Common/function.php index d1b27e42..8d8d85b8 100644 --- a/Application/Sdk/Common/function.php +++ b/Application/Sdk/Common/function.php @@ -455,4 +455,17 @@ function get_discount($gameId, $userId) ]; } return $res; +} + +// 未成年强制下线处理 +function forceOffline($userId) { + $user = M('user', 'tab_')->where(['id' => $userId])->find(); + if ($user['age_status'] == 3) { + echo base64_encode (json_encode(array( + "code" => 9999, + "msg" => "您已下线,请重新登入", + "data" => "" + ))); + exit (); + } } \ No newline at end of file diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 7d83c4bb..03c91a1e 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -30,6 +30,10 @@ class UserController extends BaseController $userService = new UserService(); $result = $userService->loginSdk($params); if ($result['status']) { + $user = M('user', 'tab_')->where(['id' => $result['user_id']])->find(); + if ($user['age_status'] == 3) { + $this->set_message(1001, "fail", "未成年禁止登入,请稍后再试!"); + } echo base64_encode(json_encode($result['data'])); } else { $this->set_message(1001, "fail", $result['message']); @@ -1439,6 +1443,8 @@ class UserController extends BaseController $this->set_message(1001, "fail", "操作数据不能为空"); } + forceOffline($request['user_id']); + $params = [ 'user_id' => $request['user_id'], 'game_id' => $request['game_id'], @@ -2524,6 +2530,9 @@ class UserController extends BaseController $log['remarks'] = '修改成功'; log_action($log); $data['status'] = 200; + + forceOffline($user['user_id']); + echo base64_encode(json_encode($data)); } From dc27d3d2e93f83f5d52c6ffcf32755bfd289dc62 Mon Sep 17 00:00:00 2001 From: tping Date: Tue, 31 Aug 2021 18:27:16 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9C=AA=E6=88=90=E5=B9=B4=E4=B8=B4?= =?UTF-8?q?=E6=97=B6=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Sdk/Controller/UserController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 03c91a1e..29d68200 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -30,7 +30,7 @@ class UserController extends BaseController $userService = new UserService(); $result = $userService->loginSdk($params); if ($result['status']) { - $user = M('user', 'tab_')->where(['id' => $result['user_id']])->find(); + $user = M('user', 'tab_')->where(['id' => $result['data']['user_id']])->find(); if ($user['age_status'] == 3) { $this->set_message(1001, "fail", "未成年禁止登入,请稍后再试!"); }