From 74fbdf4cf932e683941f98a8bc4c329f6e96d8dc Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 7 Jun 2024 11:15:10 +0800 Subject: [PATCH] 1 --- doc/AALogin.py | 2 +- webapp/controller/UserController.class.php | 40 +++++----------------- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/doc/AALogin.py b/doc/AALogin.py index e0de2772..7f0209e0 100644 --- a/doc/AALogin.py +++ b/doc/AALogin.py @@ -137,7 +137,7 @@ class AALogin(object): 'url': 'https://login-test.kingsome.cn/webapp/index.php?c=Login&a=verifyJwt', 'is_json_params': True, 'params': [ - ['data', '', 'jwt'], + ['jwt', '', 'jwt'], ], 'response': [ _common.RspHead(), diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index e14a0d12..a0f03a83 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -909,49 +909,27 @@ class UserController extends BaseAuthedController { die(); return; } - error_log(json_encode($_REQUEST)); - $jwt = getReqVal('jwt', ''); - - $arr = explode('.', $jwt); - if (count($arr) < 3) { - phpcommon\sendError(1, 'token error'); - die(); + $data = json_decode(file_get_contents('php://input'), true); + if (empty($data)) { + phpcommon\rspErr(100, 'data error'); return; } - $header = base64_decode($arr[0]); - $payload = base64_decode($arr[1]); - $sign = base64_decode($arr[2]); - $data = json_decode($payload, true); - - $subIdxPre = ''; - $subIdx = getXVal($data, 'version', ''); - if (!empty($subIdx)) { - $subIdxPre = 's' . $subIdx . '_'; - } - { - $jwtAccountId = BC_POLY_CHANNEL . '_' . myself()->_getGameId() . '_' . - $subIdxPre . $data['plat'] . '_' . $data['openid']; - if ($jwtAccountId != myself()->_getAccountId()) { - myself()->_rspErr(1, 'token error3'); - return; - } - } - - //$url = 'https://pay.cebggame.com/wallet/info?'; - $url = 'https://oauth-svr.cebggame.com/test/wallet/info?'; $params = array( - 'token' => $jwt + 'jwt' => $data['jwt'] ); $response = ''; if (!phpcommon\HttpClient::get - ($url, + (LOGIN_URL, $params, $response)) { myself()->_rspErr(500, 'server internal error'); - die(); return; } error_log($response); + if (empty($response)) { + myself()->_rspErr(500, 'server internal error'); + return; + } $rspObj = json_decode($response, true); if (empty($rspObj['data']['address'])) { User::Update(array(