diff --git a/webapp/controller/MatchController.class.php b/webapp/controller/MatchController.class.php index 3c3b1092..49c59f77 100644 --- a/webapp/controller/MatchController.class.php +++ b/webapp/controller/MatchController.class.php @@ -129,29 +129,36 @@ class MatchController extends BaseAuthedController { } else { $currMatchDb = json_decode($currMatchDb, true); $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; + $selfTeamDb = $currMatchDb[$teamUuid]; + if ($selfTeamDb && myself()->_getNowTime() - $selfTeamDb['match_time'] > 7) { + $this->matchOk($r, $teamUuid, $selfTeamDb); + $this->fillMatchInfo($r, $teamUuid, $matchInfo, $this->readMatchOk($r, $teamUuid)); + array_push($delTeams, $teamUuid); + } else { + foreach ($currMatchDb as $key => $val) { + $tmpTeamDb = $this->readTeamDb($r, $key); + if (!empty($tmpTeamDb) || $this->_getNowTime() - $tmpTeamDb['match_time'] > 120) { + array_push($delTeams, $key); } else { - foreach ($val['member_list'] as $member) { - if ($member['account_id'] == myself()->_getAccountId()) { - $found = true; - break; + $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)); + array_push($delTeams, $key); + } } - if (!$found) { - $this->matchOk($r, $teamUuid, $val); - $this->fillMatchInfo($r, $teamUuid, $matchInfo, $this->readMatchOk($r, $teamUuid)); - array_push($delTeams, $key); - } - } - }//end foreach $currMatchDb + }//end foreach $currMatchDb + } if (count($delTeams) > 0) { foreach ($delTeams as $id) { unset($delTeams[$id]);