[TeamController]

This commit is contained in:
aozhiwei 2021-07-12 19:39:37 +08:00
parent 98f60973aa
commit e52cdaed4a

View File

@ -87,7 +87,33 @@ class TeamController extends BaseAuthedController {
'team_uuid' => $team_uuid
));
}
public function resetRoom()//解散房间
{
if (!isset($_REQUEST['team_uuid'])) {
return;
}
$team_uuid = $_REQUEST['team_uuid'];
$r = $this->getRedis($team_uuid);
$accountid = $_REQUEST['account_id'];
$sessionid = $_REQUEST['session_id'];
$user_db_str = $r->get(TEAMID_KEY . $team_uuid);
if (empty($user_db_str)) {
phpcommon\sendError(ERR_USER_BASE + 1,'session失效1');
return;
}
$user_db = json_decode($user_db_str, true);
if (empty($user_db)) {
phpcommon\sendError(ERR_USER_BASE + 1,'session失效2');
return;
}
$user_db['state'] = 3;
$r->set(TEAMID_KEY . $team_uuid, json_encode($user_db));
$r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600);
$this->leaveTeam();
}
public function teamInfo()
{
if (!isset($_REQUEST['team_uuid'])) {
@ -460,6 +486,7 @@ class TeamController extends BaseAuthedController {
$r -> pexpire(TEAMID_KEY . $team_uuid, 1000 * 600);
if (count($user_db['member_list']) == 0) {
$r->del(TEAMID_KEY . $team_uuid, json_encode($user_db));
error_log("没有玩家了房间删除========");
}
}
echo json_encode(array(