From 5a5cfa57eeeeb36d5f8bf88f0278a3efcf1658c5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Apr 2024 10:49:26 +0800 Subject: [PATCH 1/5] 1 --- webapp/controller/BattleController.class.php | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index e4652913..222a4c3f 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -252,9 +252,36 @@ class BattleController extends BaseAuthedController { } } $this->switchAccount(getReqVal('account_id', 0)); + $this->updateRecentBattle($input['team_list']); $this->_rspOk(); } + private function updateRecentBattle($teamList) + { + $realPlayerHash = array(); + $realPlayerHashCopy = array(); + foreach ($teamList as $team) { + foreach ($team as $member) { + if (!myself()->_isAndroidAccountId($member['account_id'])) { + $realPlayerHash[$member['account_id']] = 1; + $realPlayerHashCopy[$member['account_id']] = 1; + } + } + } + foreach ($realPlayerHash as $accountId) { + foreach ($realPlayerHashCopy as $accountIdCopy) { + if ($accountId != $accountIdCopy) { + $accountId1 = $accountId; + $accountId2 = $accountIdCopy; + if ($accountId > $accountIdCopy) { + $accountId1 = $accountIdCopy; + $accountId2 = $accountId; + } + } + } + } + } + /* http post php://input From 385dc0dfd98d3d942240179909624bc7d90efd63 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Apr 2024 11:14:07 +0800 Subject: [PATCH 2/5] 1 --- webapp/controller/BattleController.class.php | 28 ++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 222a4c3f..18beea33 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -268,6 +268,7 @@ class BattleController extends BaseAuthedController { } } } + $accountIdPair = array(); foreach ($realPlayerHash as $accountId) { foreach ($realPlayerHashCopy as $accountIdCopy) { if ($accountId != $accountIdCopy) { @@ -277,9 +278,36 @@ class BattleController extends BaseAuthedController { $accountId1 = $accountIdCopy; $accountId2 = $accountId; } + $key = $accountId . '|' . $accountId2; + if (!array_key_exists($key, $accountIdPair)) { + $accountIdPair[$key] = array($accountId1, $accountId2); + } } } } + $nowTime = myself()->_getNowTime(); + foreach ($accountIdPair as $pair) { + $accountId1 = $pair[0]; + $accountId2 = $pair[1]; + SqlHelper::Upsert( + myself()->__getRelationDbMysql(), + 't_recent_battle', + array( + 'account_id1' => $accountId1, + 'account_id2' => $accountId2, + ), + array( + 'last_battle_time' => $nowTime, + ), + array( + 'account_id1' => $accountId1, + 'account_id2' => $accountId2, + 'last_battle_time' => $nowTime, + 'createtime' => $nowTime, + 'modifytime' => $nowTime, + ) + ); + } } /* From a60044fb9017ea18a77c6ac0c57368ac55ddd991 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Apr 2024 11:26:51 +0800 Subject: [PATCH 3/5] 1 --- webapp/controller/BattleController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 18beea33..a862fd8d 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -261,7 +261,7 @@ class BattleController extends BaseAuthedController { $realPlayerHash = array(); $realPlayerHashCopy = array(); foreach ($teamList as $team) { - foreach ($team as $member) { + foreach ($team['members'] as $member) { if (!myself()->_isAndroidAccountId($member['account_id'])) { $realPlayerHash[$member['account_id']] = 1; $realPlayerHashCopy[$member['account_id']] = 1; From c47ad757621ea381d46c041c6c437624e24b0e01 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Apr 2024 11:52:53 +0800 Subject: [PATCH 4/5] 1 --- webapp/controller/BattleController.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index a862fd8d..9a61ae82 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -268,9 +268,10 @@ class BattleController extends BaseAuthedController { } } } + error_log(json_encode($realPlayerHash)); $accountIdPair = array(); - foreach ($realPlayerHash as $accountId) { - foreach ($realPlayerHashCopy as $accountIdCopy) { + foreach ($realPlayerHash as $accountId => $val) { + foreach ($realPlayerHashCopy as $accountIdCopy => $valCopy) { if ($accountId != $accountIdCopy) { $accountId1 = $accountId; $accountId2 = $accountIdCopy; @@ -285,12 +286,13 @@ class BattleController extends BaseAuthedController { } } } + error_log(json_encode($accountIdPair)); $nowTime = myself()->_getNowTime(); foreach ($accountIdPair as $pair) { $accountId1 = $pair[0]; $accountId2 = $pair[1]; SqlHelper::Upsert( - myself()->__getRelationDbMysql(), + myself()->_getRelationDbMysql(), 't_recent_battle', array( 'account_id1' => $accountId1, From 354872c38cb86c16abea12b6e7d0f6b3063b7e8b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Apr 2024 15:16:06 +0800 Subject: [PATCH 5/5] 1 --- webapp/controller/UserController.class.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index f0ff03dc..9dd43bc0 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -457,8 +457,10 @@ class UserController extends BaseAuthedController { public function getMapConf() { + $modeId = getReqVal('mode_id', 0); $mapId = getReqVal('map_id', 0); $mapInfo = array( + 'mode_id' => $modeId, 'map_id' => 0, 'is_moba' => 0, 'is_open' => 0 @@ -474,8 +476,10 @@ class UserController extends BaseAuthedController { public function getBattleInfo() { + $modeId = getReqVal('mode_id', 0); $mapId = getReqVal('map_id', 0); $mapInfo = array( + 'mode_id' => $modeId, 'map_id' => 0, 'is_moba' => 0, 'is_open' => 0