This commit is contained in:
hujiabin 2023-09-06 14:18:05 +08:00
parent 8607639179
commit b5cfe0639c
4 changed files with 45 additions and 33 deletions

View File

@ -78,34 +78,6 @@ class Team(object):
_common.RspHead(), _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', 'name': 'handover',
'desc': '转移队长职位', 'desc': '转移队长职位',
@ -203,17 +175,29 @@ class Team(object):
_common.RspHead(), _common.RspHead(),
] ]
},{ },{
'name': 'getPveFragmentNumOrDay', 'name': 'updateTeam',
'desc': '当天获取碎片的数量', 'desc': '跟新队伍信息',
'group': 'Team', 'group': 'Team',
'url': 'webapp/index.php?c=Team&a=getPveFragmentNumOrDay', 'url': 'webapp/index.php?c=Team&a=updateTeam',
'params': [ 'params': [
_common.ReqHead(), _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': [ 'response': [
_common.RspHead(), _common.RspHead(),
['heroNum',0,'英雄碎片数量'],
['gunNum',0,'枪械碎片数量']
] ]
}, },
] ]

View File

@ -685,6 +685,7 @@ class TeamMember(object):
['kills', 0, '击杀数'], ['kills', 0, '击杀数'],
['is_leader', 0, '是否队长'], ['is_leader', 0, '是否队长'],
['is_ready', 0, '是否准备'], ['is_ready', 0, '是否准备'],
['permission', 0, '邀请许可'],
['createtime', 0, '账号创建时间'], ['createtime', 0, '账号创建时间'],
] ]

View File

@ -78,6 +78,7 @@ class TeamController extends BaseAuthedController {
$userDto = User::toPreset($userDb); $userDto = User::toPreset($userDb);
$userDto['is_leader'] = 1; $userDto['is_leader'] = 1;
$userDto['is_ready'] = 1; $userDto['is_ready'] = 1;
$userDto['permission'] = 1;
$userDto['createtime'] = $userDb['createtime']; $userDto['createtime'] = $userDb['createtime'];
$teamDb = array( $teamDb = array(
'team_uuid' => $teamUuid, '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) private function readTeamDb($r, $teamUuid)
{ {

View File

@ -311,6 +311,7 @@ class User extends BaseModel {
'presetInfo' => $preset, 'presetInfo' => $preset,
'is_leader' => 0, 'is_leader' => 0,
'is_ready' => 0, 'is_ready' => 0,
'permission' => 0,
'honor_info' => $honorInfo, 'honor_info' => $honorInfo,
); );