diff --git a/webapp/bootstrap/constant.php b/webapp/bootstrap/constant.php index 8d053a81..2d998aa6 100644 --- a/webapp/bootstrap/constant.php +++ b/webapp/bootstrap/constant.php @@ -7,6 +7,7 @@ define('PLANET_BUY_KEY', 'game2006api:planet_buy:'); define('LAST_SESSION_KEY', 'last_session:'); define('MATCH_CURRENT_TEAM_KEY', 'match:current_team:'); +define('MATCH_OK_KEY', 'match:current_team:'); define('V_ITEM_GOLD', 10001); //金币 define('V_ITEM_DIAMOND', 10014); //钻石 diff --git a/webapp/controller/MatchController.class.php b/webapp/controller/MatchController.class.php index 2938b405..803cee4f 100644 --- a/webapp/controller/MatchController.class.php +++ b/webapp/controller/MatchController.class.php @@ -32,7 +32,7 @@ class MatchController extends BaseAuthedController { $this->_rspErr(1, 'The team has been disbanded'); return; } - $r->pexpire(TEAMID_KEY . $teamUuid, 1000*600); + $matchDb = $this->readCurrMatchTeam($r); $this->_rspData(array( 'team_info' => $teamDb )); @@ -54,13 +54,20 @@ class MatchController extends BaseAuthedController { if (empty($teamDbStr)) { return null; } + $r->refreshKeyExpire($r, TEAMID_KEY . $teamUuid, 1000*600); $teamDb = json_decode($teamDbStr, true); return $teamDb; } + /* + { + "current_team": "dafsdf" + "match_time": 231434 + } + */ private function readCurrMatchTeam($r) { - $teamDbStr = $r->get(MATCH_CURRENT_TEAM_KEY . $teamUuid); + $teamDbStr = $r->get(MATCH_CURRENT_TEAM_KEY); if (empty($teamDbStr)) { return null; } @@ -68,4 +75,26 @@ class MatchController extends BaseAuthedController { return $teamDb; } + /* + { + "target_team": "dafsdf" + "match_time": 231434 + } + */ + private function readMatchOk($r, $teamUuid) + { + $teamDbStr = $r->get(MATCH_OK_KEY . $teamUuid); + if (empty($teamDbStr)) { + return null; + } + $this->refreshKeyExpire($r, MATCH_OK_KEY . $teamUuid, 1000*600); + $teamDb = json_decode($teamDbStr, true); + return $teamDb; + } + + private function refreshKeyExpire($r, $key, $time) + { + $r->pexpire($key, $time); + } + }