From 706b05d77af18d08caf90ea32bcee27dc504a4c8 Mon Sep 17 00:00:00 2001 From: tpingzhang <635929049@qq.com> Date: Thu, 21 Nov 2019 20:36:39 +0800 Subject: [PATCH] =?UTF-8?q?get=5Fdown=5Ftime=20=20=E4=B8=8D=E9=AA=8C?= =?UTF-8?q?=E8=AF=81user=5Ftoken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sdk/Controller/BaseController.class.php | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/Application/Sdk/Controller/BaseController.class.php b/Application/Sdk/Controller/BaseController.class.php index be348120..f6aeb6ce 100644 --- a/Application/Sdk/Controller/BaseController.class.php +++ b/Application/Sdk/Controller/BaseController.class.php @@ -17,7 +17,8 @@ class BaseController extends RestController{ ]; protected $noToken = [ 'user_login', 'send_sms', 'verify_sms', 'forget_password', - 'init_sdk', 'device_record', 'force_update', 'thirdparty', 'get_customer_question' + 'init_sdk', 'device_record', 'force_update', 'thirdparty', 'get_customer_question', + 'get_down_time' ]; // 不需要验证TOKEN的接口 protected $noNeedToken = [ @@ -40,25 +41,31 @@ class BaseController extends RestController{ if ((!(in_array($c, $this->noNeedGame) || in_array($a, $this->noNeedGame) - || in_array($c.".".$a, $this->noNeedGame))) && - (!(in_array($c, $this->noToken) - || in_array($a, $this->noToken) - || in_array($c.".".$a, $this->noToken)))) { - if ($data['api_ver'] == 2) { - $userToken = M('user_token', 'tab_')->where([ - 'user_id' => $data['user_id'], - 'game_id' => $data['game_id'] - ])->getField('user_token'); - if (!$userToken || $userToken != $data['user_token']) { - echo base64_encode (json_encode(array( - "code" => 9999, - "msg" => "您已下线,请重新登入", - "data" => "" - ))); - exit (); - // 退出 + || in_array($c.".".$a, $this->noNeedGame)))) { + + + if (!(in_array($c, $this->noToken) + || in_array($a, $this->noToken) + || in_array($c.".".$a, $this->noToken))) { + + if ($data['api_ver'] == 2) { + $userToken = M('user_token', 'tab_')->where([ + 'user_id' => $data['user_id'], + 'game_id' => $data['game_id'] + ])->getField('user_token'); + if (!$userToken || $userToken != $data['user_token']) { + echo base64_encode (json_encode(array( + "code" => 9999, + "msg" => "您已下线,请重新登入", + "data" => "" + ))); + exit (); + // 退出 + } } } + + $this->userToken = $userToken; /*