From c761d426fbef40bae5b3e4ba6c0e3593dfbd82ee Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 21 Sep 2023 16:25:45 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=9F=E4=BC=8D=E4=BF=A1=E6=81=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/Team.py | 15 +++++++++++ doc/_common.py | 12 +++++++++ webapp/controller/TeamController.class.php | 31 +++++++++++++++++++++- 3 files changed, 57 insertions(+), 1 deletion(-) diff --git a/doc/Team.py b/doc/Team.py index 30c48576..b22ef6d2 100644 --- a/doc/Team.py +++ b/doc/Team.py @@ -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(), + ] }, ] diff --git a/doc/_common.py b/doc/_common.py index efcff4fc..bd9188a8 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -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): diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index df097660..ec2f3b54 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -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) {