From 2c2d5ca9b96d769dc00a4ad5c6115dc386c67e01 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 8 Jun 2023 13:11:55 +0800 Subject: [PATCH] 1 --- doc/User.py | 2 ++ webapp/controller/UserController.class.php | 33 +++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/User.py b/doc/User.py index e5e2a325..5a8ab150 100644 --- a/doc/User.py +++ b/doc/User.py @@ -205,6 +205,8 @@ class User(object): ], 'response': [ _common.RspHead(), + ['is_retry', 0, '是否重试 0:不用重试 1:重试'], + ['retry_time', 0, '重试时间(单位秒)'], ] }, ] diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index e5077a67..fb9687ba 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -805,7 +805,38 @@ class UserController extends BaseAuthedController { public function updateAddressBind() { - $hero_uniid = getReqVal('jwt', ''); + error_log(json_encode($_REQUEST)); + $jwt = getReqVal('jwt', ''); + + $arr = explode('.', $jwt); + if (count($arr) < 3) { + phpcommon\sendError(1, 'token error'); + die(); + return; + } + $header = base64_decode($arr[0]); + $payload = base64_decode($arr[1]); + $sign = base64_decode($arr[2]); + $data = json_decode($payload, true); + + $url = 'https://pay.cebggame.com/wallet/info?'; + $params = array( + 'token' => $jwt + ); + $response = ''; + if (!phpcommon\HttpClient::get + ($url, + $params, + $response)) { + myself()->_rspErr(500, 'server internal error'); + die(); + return; + } + error_log($response); + $rspObj = json_decode($response, true); + User::Update(array( + 'address' => $rspObj['address'] + )); $this->_rspOk(); }