From 5a5cfa57eeeeb36d5f8bf88f0278a3efcf1658c5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 16 Apr 2024 10:49:26 +0800 Subject: [PATCH] 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