diff --git a/doc/Team.py b/doc/Team.py index b2e2581c..1b4925b0 100644 --- a/doc/Team.py +++ b/doc/Team.py @@ -78,34 +78,6 @@ class Team(object): _common.RspHead(), ] }, - { - 'name': 'closeSlot', - 'desc': '关闭槽位', - 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=closeSlot', - 'params': [ - _common.ReqHead(), - ['team_uuid', '', '队伍唯一id'], - ['slot_id', '', '队伍卡槽id 共计:1 2 3 4'], - ], - 'response': [ - _common.RspHead(), - ] - }, - { - 'name': 'openSlot', - 'desc': '开启槽位', - 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=openSlot', - 'params': [ - _common.ReqHead(), - ['team_uuid', '', '队伍唯一id'], - ['slot_num', '', '队伍人数'], - ], - 'response': [ - _common.RspHead(), - ] - }, { 'name': 'handover', 'desc': '转移队长职位', @@ -203,17 +175,29 @@ class Team(object): _common.RspHead(), ] },{ - 'name': 'getPveFragmentNumOrDay', - 'desc': '当天获取碎片的数量', + 'name': 'updateTeam', + 'desc': '跟新队伍信息', 'group': 'Team', - 'url': 'webapp/index.php?c=Team&a=getPveFragmentNumOrDay', + 'url': 'webapp/index.php?c=Team&a=updateTeam', 'params': [ _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ], + 'response': [ + _common.RspHead(), + ] + },{ + 'name': 'permission', + 'desc': '邀请许可', + 'group': 'Team', + 'url': 'webapp/index.php?c=Team&a=permission', + 'params': [ + _common.ReqHead(), + ['team_uuid', '', '队伍唯一id'], + ['target_id', '', '目标account_id'], ], 'response': [ _common.RspHead(), - ['heroNum',0,'英雄碎片数量'], - ['gunNum',0,'枪械碎片数量'] ] }, ] diff --git a/doc/_common.py b/doc/_common.py index 6dce77e0..9bf5618d 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -685,6 +685,7 @@ class TeamMember(object): ['kills', 0, '击杀数'], ['is_leader', 0, '是否队长'], ['is_ready', 0, '是否准备'], + ['permission', 0, '邀请许可'], ['createtime', 0, '账号创建时间'], ] diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index d8cf1bf3..cb6ba7fb 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -78,6 +78,7 @@ class TeamController extends BaseAuthedController { $userDto = User::toPreset($userDb); $userDto['is_leader'] = 1; $userDto['is_ready'] = 1; + $userDto['permission'] = 1; $userDto['createtime'] = $userDb['createtime']; $teamDb = array( 'team_uuid' => $teamUuid, @@ -560,6 +561,31 @@ class TeamController extends BaseAuthedController { )); } + public function permission(){ + $teamUuid = getReqVal('team_uuid', ''); + $accountId = getReqVal('target_id', ''); + $r = $this->_getRedis($teamUuid); + $teamDb = $this->readTeamDb($r, $teamUuid); + if (empty($teamDb)) { + $this->_rspErr(1, 'The team has been disbanded'); + return; + } + foreach ($teamDb['member_list'] as &$member) { + if ($member['account_id'] == $this->_getAccountId() && $member['is_leader'] != 1){ + $this->_rspErr(1, 'You are not the captain.'); + return; + } + if ($member['account_id'] == $accountId){ + $member['permission'] = 1; + } + + } + $this->saveTeamDb($r, $teamUuid, $teamDb); + $this->_rspData(array( + 'team_uuid' => $teamUuid + )); + } + private function readTeamDb($r, $teamUuid) { diff --git a/webapp/models/User.php b/webapp/models/User.php index c1513817..25d926fd 100644 --- a/webapp/models/User.php +++ b/webapp/models/User.php @@ -311,6 +311,7 @@ class User extends BaseModel { 'presetInfo' => $preset, 'is_leader' => 0, 'is_ready' => 0, + 'permission' => 0, 'honor_info' => $honorInfo, );