From 2420298d1978d1b5e7c4074e737080377b309273 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 26 Dec 2023 18:06:58 +0800 Subject: [PATCH] 1 --- webapp/controller/MatchController.class.php | 28 +++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/webapp/controller/MatchController.class.php b/webapp/controller/MatchController.class.php index c532c843..06208816 100644 --- a/webapp/controller/MatchController.class.php +++ b/webapp/controller/MatchController.class.php @@ -120,7 +120,7 @@ class MatchController extends BaseAuthedController { if (empty($currMatchDb)) { $currMatchDb = array( $teamUuid => array( - 'current_team' => $teamUuid, + 'team_uuid' => $teamUuid, 'match_time' => $this->_getNowTime() ) ); @@ -128,10 +128,28 @@ class MatchController extends BaseAuthedController { $this->refreshKeyExpire($r, MATCH_CURRENT_TEAM_KEY, 1000*600); } else { $currMatchDb = json_decode($currMatchDb, true); - if ($currMatchDb['current_team'] != $teamUuid) { - $this->matchOk($r, $teamUuid, $currMatchDb); - $this->fillMatchInfo($r, $teamUuid, $matchInfo, $this->readMatchOk($r, $teamUuid)); - } else { + $delTeams = array(); + foreach ($currMatchDb as $key => $val) { + $tmpTeamDb = $this->readTeamDb($r, $key); + if (!empty($tmpTeamDb) || $this->_getNowTime() - $tmpTeamDb['match_time'] > 120) { + array_push($delTeams, $key); + } else { + $found = false; + if ($key == $teamUuid) { + $found = true; + } else { + foreach ($val['member_list'] as $member) { + if ($member['account_id'] == myself()->_getAccountId()) { + $found = true; + break; + } + } + } + if (!$found) { + $this->matchOk($r, $teamUuid, $val); + $this->fillMatchInfo($r, $teamUuid, $matchInfo, $this->readMatchOk($r, $teamUuid)); + } + } } } }