This commit is contained in:
aozhiwei 2023-12-26 14:23:50 +08:00
parent e61198c2a8
commit 69fd8c5bd0
2 changed files with 32 additions and 2 deletions

View File

@ -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); //钻石

View File

@ -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);
}
}