队伍信息修改

This commit is contained in:
hujiabin 2023-09-21 16:25:45 +08:00
parent c9f8433356
commit c761d426fb
3 changed files with 57 additions and 1 deletions

View File

@ -167,5 +167,20 @@ class Team(object):
'response': [
_common.RspHead(),
]
},{
'name': 'setCustomInfo',
'desc': '设置队伍自定义房间',
'group': 'Team',
'url': 'webapp/index.php?c=Team&a=setCustomInfo',
'params': [
_common.ReqHead(),
['team_uuid', '', '队伍唯一id'],
['custom_room_id', '', '自定义房间的ID'],
['custom_room_state', '', '自定义房间的状态'],
['custom_room_pwd', '', '自定义房间的密码'],
],
'response': [
_common.RspHead(),
]
},
]

View File

@ -694,15 +694,27 @@ class TeamInfo(object):
def __init__(self):
self.fields = [
['map_id', '', '地图id'],
['node_id', '', 'node_id'],
['zid', '', 'zid'],
['team_uuid', '', '队伍唯一id'],
['payload', '', '透传给CMJoin'],
['match_mode', 0, '0: 匹配赛模式 1: 排位赛 3: pve'],
['pve_instance_id', 0, 'pve副本id'],
['slot_num', 0, '槽位数 >=1 && <= 4'],
['state', 0, '0:未开始 1:准备就绪(这时客户端进入长链接走组队逻辑)'],
['custom_room', CustomRoom(), '自定义房间'],
['!member_list', [TeamMember()], '队伍成员列表(包含自己)'],
]
class CustomRoom(object):
def __init__(self):
self.fields = [
['custom_room_id', '', '自定义房间的ID'],
['custom_room_state', '', '自定义房间的状态'],
['custom_room_pwd', '', '自定义房间的密码'],
]
class BuyableBox(object):
def __init__(self):

View File

@ -83,13 +83,17 @@ class TeamController extends BaseAuthedController {
$userDto['createtime'] = $userDb['createtime'];
$teamDb = array(
'map_id' => $mapId,
'node_id' => $nodeId,
'zid' => $zid,
'team_uuid' => $teamUuid,
'state' => 0,
'payload' => '',
'match_mode' => $matchMode,
'pve_instance_id' => $pveInstanceId,
'slot_num' => 1,
'member_list' => array($userDto));
'member_list' => array($userDto),
'custom_room' => array(),
);
$r = $this->_getRedis($teamUuid);
$this->saveTeamDb($r, $teamUuid, $teamDb);
@ -483,6 +487,31 @@ class TeamController extends BaseAuthedController {
));
}
public function setCustomInfo(){
$custom_room_state = getReqVal('custom_room_state', '');
$custom_room_id = getReqVal('custom_room_id', '');
$custom_room_pwd = getReqVal('custom_room_pwd', '');
$teamUuid = getReqVal('team_uuid', '');
$r = $this->_getRedis($teamUuid);
$teamDb = $this->readTeamDb($r, $teamUuid);
if (empty($teamDb)) {
$this->_rspErr(1, 'The team has been disbanded');
return;
}
$teamDb['custom_room'] = array(
'custom_room_id' => $custom_room_id,
'custom_room_state' => $custom_room_state,
'custom_room_pwd' => $custom_room_state,
);
// $teamDb['custom_room_id'] = $custom_room_id;
// $teamDb['custom_room_state'] = $custom_room_state;
// $teamDb['custom_room_pwd'] = $custom_room_state;
$this->saveTeamDb($r, $teamUuid, $teamDb);
$this->_rspData(array(
'team_uuid' => $teamUuid
));
}
private function readTeamDb($r, $teamUuid)
{