This commit is contained in:
aozhiwei 2023-12-26 17:25:48 +08:00
parent 12b0abc9c0
commit f40ebe1918

View File

@ -43,21 +43,7 @@ class MatchController extends BaseAuthedController {
$this->refreshKeyExpire($r, TEAMID_KEY . $matchOkDb['target_team'], 1000*600);
$this->fillMatchInfo($r, $teamUuid, $matchInfo, $matchOkDb);
} else {
$currMatchDb = $this->readCurrMatchTeam($r);
if (empty($currMatchDb)) {
$currMatchDb = array(
'current_team' => $teamUuid,
'match_time' => $this->_getNowTime()
);
$r->set(MATCH_CURRENT_TEAM_KEY, json_encode($currMatchDb));
$this->refreshKeyExpire($r, MATCH_CURRENT_TEAM_KEY, 1000*600);
} else {
if ($currMatchDb['current_team'] != $teamUuid) {
$this->matchOk($r, $teamUuid, $currMatchDb);
$this->fillMatchInfo($r, $teamUuid, $matchInfo, $this->readMatchOk($r, $teamUuid));
} else {
}
}
$this->execMatch($r, $teamUuid, $teamDb, $matchInfo);
}
$this->_rspData($matchInfo);
}
@ -90,9 +76,11 @@ class MatchController extends BaseAuthedController {
/*
{
"": {
"current_team": "dafsdf"
"match_time": 231434
}
}
*/
private function readCurrMatchTeam($r)
{
@ -126,6 +114,25 @@ class MatchController extends BaseAuthedController {
$r->pexpire($key, $time);
}
private function execMatch($r, $teamUuid, $teamDb, &$matchInfo)
{
$currMatchDb = $this->readCurrMatchTeam($r);
if (empty($currMatchDb)) {
$currMatchDb = array(
'current_team' => $teamUuid,
'match_time' => $this->_getNowTime()
);
$r->set(MATCH_CURRENT_TEAM_KEY, json_encode($currMatchDb));
$this->refreshKeyExpire($r, MATCH_CURRENT_TEAM_KEY, 1000*600);
} else {
if ($currMatchDb['current_team'] != $teamUuid) {
$this->matchOk($r, $teamUuid, $currMatchDb);
$this->fillMatchInfo($r, $teamUuid, $matchInfo, $this->readMatchOk($r, $teamUuid));
} else {
}
}
}
private function matchOk($r, $teamUuid, $currMatchDb)
{
{