身份验证

master
zhanglingsheng 5 years ago
parent 4297e931f2
commit 6417434c20

@ -16,7 +16,7 @@ class BaseController extends RestController{
]; ];
protected $noToken = [ 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' 'init_sdk', 'device_record', 'force_update', 'thirdparty', 'get_customer_question'
]; ];
// 不需要验证TOKEN的接口 // 不需要验证TOKEN的接口

@ -1525,7 +1525,24 @@ class UserController extends BaseController
C(api('Config/lists')); C(api('Config/lists'));
$user = json_decode(base64_decode(file_get_contents("php://input")), true); $user = json_decode(base64_decode(file_get_contents("php://input")), true);
$model = M("user", "tab_"); $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']) { switch ($user['type']) {
case 0: case 0:

Loading…
Cancel
Save