This commit is contained in:
aozhiwei 2024-06-07 11:15:10 +08:00
parent e36f46a9e9
commit 74fbdf4cf9
2 changed files with 10 additions and 32 deletions

View File

@ -137,7 +137,7 @@ class AALogin(object):
'url': 'https://login-test.kingsome.cn/webapp/index.php?c=Login&a=verifyJwt', 'url': 'https://login-test.kingsome.cn/webapp/index.php?c=Login&a=verifyJwt',
'is_json_params': True, 'is_json_params': True,
'params': [ 'params': [
['data', '', 'jwt'], ['jwt', '', 'jwt'],
], ],
'response': [ 'response': [
_common.RspHead(), _common.RspHead(),

View File

@ -909,49 +909,27 @@ class UserController extends BaseAuthedController {
die(); die();
return; return;
} }
error_log(json_encode($_REQUEST)); $data = json_decode(file_get_contents('php://input'), true);
$jwt = getReqVal('jwt', ''); if (empty($data)) {
phpcommon\rspErr(100, 'data error');
$arr = explode('.', $jwt);
if (count($arr) < 3) {
phpcommon\sendError(1, 'token error');
die();
return; 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( $params = array(
'token' => $jwt 'jwt' => $data['jwt']
); );
$response = ''; $response = '';
if (!phpcommon\HttpClient::get if (!phpcommon\HttpClient::get
($url, (LOGIN_URL,
$params, $params,
$response)) { $response)) {
myself()->_rspErr(500, 'server internal error'); myself()->_rspErr(500, 'server internal error');
die();
return; return;
} }
error_log($response); error_log($response);
if (empty($response)) {
myself()->_rspErr(500, 'server internal error');
return;
}
$rspObj = json_decode($response, true); $rspObj = json_decode($response, true);
if (empty($rspObj['data']['address'])) { if (empty($rspObj['data']['address'])) {
User::Update(array( User::Update(array(