|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|