From 911e2247822f5b5b2c5dc97f09ea7b30550b8e28 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 13:39:47 +0800 Subject: [PATCH 01/10] 1 --- third_party/phpcommon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/phpcommon b/third_party/phpcommon index 1913ff11..55e2f9de 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit 1913ff111893e9583dff228c9bc24669ec2e86b0 +Subproject commit 55e2f9deb1eb1eede1e8c390c7bd166528632e8a From ca5dfa1349174901740f3d57b6094433a58c8d08 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 14:46:02 +0800 Subject: [PATCH 02/10] 1 --- webapp/models/User.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webapp/models/User.php b/webapp/models/User.php index 1365606b..1f331230 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -33,6 +33,18 @@ class User extends BaseModel { return $row ? $row : null; } + public static function findByAddress($address) + { + $row = SqlHelper::ormSelectOne + (myself()->_getMysql($targetId), + 't_user', + array( + 'address' => $address + ) + ); + return $row ? $row : null; + } + public static function findUserAddress($accountId) { $row = SqlHelper::ormSelectOne From 9e9486f9f9dd44ce8bd70d5d7740245e4f4d3058 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 14:48:27 +0800 Subject: [PATCH 03/10] 1 --- webapp/controller/UserController.class.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 67f35d87..c8234006 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -806,9 +806,15 @@ class UserController extends BaseAuthedController { die(); return; } - User::Update(array( - 'address' => $rspObj['data']['address'] - )); + $address = strtolower($rspObj['data']['address']); + $oldUser = User::findByAddress($address); + if ($oldUser) { + + } else { + User::Update(array( + 'address' => $address + )); + } $propertyChgService = new services\PropertyChgService(); $propertyChgService->addUserChg(); $this->_rspData(array( From ccd06f61a9110c9c7308cc0a0f70ff828e4227fe Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 15:06:21 +0800 Subject: [PATCH 04/10] 1 --- webapp/controller/UserController.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index c8234006..01570bd6 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -809,7 +809,9 @@ class UserController extends BaseAuthedController { $address = strtolower($rspObj['data']['address']); $oldUser = User::findByAddress($address); if ($oldUser) { + if ($oldUser['account_id'] != myself()->_getAccountId()) { + } } else { User::Update(array( 'address' => $address From 9d39b424cd66452f3811ea5591a3972bbd72e035 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 15:09:31 +0800 Subject: [PATCH 05/10] 1 --- webapp/controller/UserController.class.php | 11 ++++++++++- webapp/models/User.php | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 01570bd6..0a7ed47f 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -810,7 +810,16 @@ class UserController extends BaseAuthedController { $oldUser = User::findByAddress($address); if ($oldUser) { if ($oldUser['account_id'] != myself()->_getAccountId()) { - + SqlHelper::upsert + ($this->_getSelfMysql(), + 't_user', + array( + 'account_id' => $this->_getAccountId() + ), + array( + ), + $fields + ); } } else { User::Update(array( diff --git a/webapp/models/User.php b/webapp/models/User.php index 1f331230..a2322b1d 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -36,7 +36,7 @@ class User extends BaseModel { public static function findByAddress($address) { $row = SqlHelper::ormSelectOne - (myself()->_getMysql($targetId), + (myself()->_getMysql(''), 't_user', array( 'address' => $address From 627a3965d0a297306207aac0e48ec73097021f32 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 15:12:06 +0800 Subject: [PATCH 06/10] 1 --- webapp/controller/UserController.class.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 0a7ed47f..8e1538d4 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -810,22 +810,11 @@ class UserController extends BaseAuthedController { $oldUser = User::findByAddress($address); if ($oldUser) { if ($oldUser['account_id'] != myself()->_getAccountId()) { - SqlHelper::upsert - ($this->_getSelfMysql(), - 't_user', - array( - 'account_id' => $this->_getAccountId() - ), - array( - ), - $fields - ); } - } else { - User::Update(array( - 'address' => $address - )); } + User::Update(array( + 'address' => $address + )); $propertyChgService = new services\PropertyChgService(); $propertyChgService->addUserChg(); $this->_rspData(array( From b572887ca2e3edbb9298989187dcc85cdded16d1 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 15:24:48 +0800 Subject: [PATCH 07/10] 1 --- webapp/controller/UserController.class.php | 6 ++++++ webapp/models/User.php | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 8e1538d4..9eb05681 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -810,6 +810,12 @@ class UserController extends BaseAuthedController { $oldUser = User::findByAddress($address); if ($oldUser) { if ($oldUser['account_id'] != myself()->_getAccountId()) { + User::updateOther( + $oldUser['account_id'], + array( + 'address' => null + ) + ); } } User::Update(array( diff --git a/webapp/models/User.php b/webapp/models/User.php index a2322b1d..9bdd8a51 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -371,6 +371,17 @@ class User extends BaseModel { ); } + public static function updateOther($accountId, $fieldsKv){ + SqlHelper::update + (myself()->_getMysql($accountId), + 't_user', + array( + 'account_id' => $accountId, + ), + $fieldsKv + ); + } + public static function updateLikeCount($targetId){ SqlHelper::update (myself()->_getSelfMysql(), From b599b999a5ffa4ae2136dbe112c16bda28012ada Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 16:15:08 +0800 Subject: [PATCH 08/10] 1 --- third_party/phpcommon | 2 +- webapp/controller/ToolsController.class.php | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/third_party/phpcommon b/third_party/phpcommon index 55e2f9de..85b467ba 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit 55e2f9deb1eb1eede1e8c390c7bd166528632e8a +Subproject commit 85b467ba2eca1f843f0f988823741c0d00b2724d diff --git a/webapp/controller/ToolsController.class.php b/webapp/controller/ToolsController.class.php index ad9d9b90..225a21a7 100644 --- a/webapp/controller/ToolsController.class.php +++ b/webapp/controller/ToolsController.class.php @@ -103,6 +103,18 @@ class ToolsController extends BaseController { myself()->_rspOk(); } + public function isSameSeriesAccount() + { + $accountId1 = getReqVal('account_id1', ''); + $accountId2 = getReqVal('account_id2', ''); + error_log(phpcommon\extractOpenId($accountId1)); + error_log(phpcommon\extractRealOpenId(phpcommon\extractOpenId($accountId1))); + error_log($accountId1 . ' **** ' . $accountId2 . ' ' . + phpcommon\isSameSeriesAccount($accountId1, $accountId2)); + myself()->_rspData(array( + + )); + } private function writeToFile($fileName, $data) { From ae117d80aa2308c0ca2495a4f97f1580369f9e12 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 16:19:27 +0800 Subject: [PATCH 09/10] 1 --- webapp/controller/UserController.class.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 9eb05681..fe7fc626 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -810,6 +810,13 @@ class UserController extends BaseAuthedController { $oldUser = User::findByAddress($address); if ($oldUser) { if ($oldUser['account_id'] != myself()->_getAccountId()) { + if (!phpcommon\isSameSeriesAccount( + $oldUser['account_id'], + myself()->_getAccountId() + )) { + myself()->_rspErr(1, 'is not SameSeriesAccount'); + return; + } User::updateOther( $oldUser['account_id'], array( From 565a7374d105994614448621b6f3d935917925aa Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 10 Aug 2023 16:44:09 +0800 Subject: [PATCH 10/10] 1 --- webapp/controller/BaseAuthedController.class.php | 5 +++++ webapp/controller/UserController.class.php | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index c8a63855..6b7f9282 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -155,6 +155,11 @@ class BaseAuthedController extends BaseController { return $this->accountId; } + public function _getGameId() + { + return phpcommon\extractGameId($this->_getAccountId()); + } + public function _getOpenId() { return phpcommon\extractOpenId($this->_getAccountId()); diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index fe7fc626..4f49def0 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -783,6 +783,20 @@ class UserController extends BaseAuthedController { $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?'; $params = array( 'token' => $jwt