From 6417434c20305b588f7c16bc30f1475cc162bd9c Mon Sep 17 00:00:00 2001 From: zhanglingsheng Date: Thu, 21 Nov 2019 17:23:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BA=AB=E4=BB=BD=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/BaseController.class.php | 2 +- .../Sdk/Controller/UserController.class.php | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index cbf04b16..be348120 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -16,7 +16,7 @@ class BaseController extends RestController{ ]; protected $noToken = [ - 'user_login', 'user_info', 'send_sms', 'verify_sms', 'forget_password', + 'user_login', 'send_sms', 'verify_sms', 'forget_password', 'init_sdk', 'device_record', 'force_update', 'thirdparty', 'get_customer_question' ]; // 不需要验证TOKEN的接口 diff --git a/Application/Sdk/Controller/UserController.class.php b/Application/Sdk/Controller/UserController.class.php index 16255622..4f9489e4 100644 --- a/Application/Sdk/Controller/UserController.class.php +++ b/Application/Sdk/Controller/UserController.class.php @@ -1525,7 +1525,24 @@ class UserController extends BaseController C(api('Config/lists')); $user = json_decode(base64_decode(file_get_contents("php://input")), true); $model = M("user", "tab_"); - $data = array(); + $data = array(); //type为0需要验证user_token + if($user['type'] == 0) { + if ($user['api_ver'] == 2) { + $userToken = M('user_token', 'tab_')->where([ + 'user_id' => $user['user_id'], + 'game_id' => $user['game_id'] + ])->getField('user_token'); + if (!$userToken || $userToken != $user['user_token']) { + echo base64_encode (json_encode(array( + "code" => 9999, + "msg" => "您已下线,请重新登入", + "data" => "" + ))); + exit (); + // 退出 + } + } + } switch ($user['type']) { case 0: