This commit is contained in:
hujiabin 2022-09-19 17:20:42 +08:00
parent c541c4405c
commit ab7fd27243

View File

@ -193,11 +193,11 @@ class TeamController extends BaseAuthedController {
public function closeSlot()
{
$teamUuid = getReqVal('team_uuid', '');
$slot_id = getReqVal('slot_id', 0);
if (! in_array($slot_id,array(1,2,3,4)) ){
$this->_rspErr(1, 'slot_id param error');
return;
}
// $slot_id = getReqVal('slot_id', 0);
// if (! in_array($slot_id,array(1,2,3,4)) ){
// $this->_rspErr(1, 'slot_id param error');
// return;
// }
$r = $this->_getRedis($teamUuid);
$teamDb = $this->readTeamDb($r, $teamUuid);
@ -215,16 +215,11 @@ class TeamController extends BaseAuthedController {
$this->_rspErr(1, 'Minimum size of team');
return;
}
if ($teamDb['member_list'][$slot_id-1]['account_id'] == $this->_getAccountId()){
$this->_rspErr(1, 'do not get myself out of line');
if (count($teamDb['member_list'])== 4){
$this->_rspErr(1, "Can't shut down");
return;
}
if(array_key_exists($slot_id-1,$teamDb['member_list'])){
unset($teamDb['member_list'][$slot_id-1]);
$teamDb['slot_num']-=1;
}else{
$teamDb['slot_num']-=1;
}
$teamDb['slot_num']-=1;
$this->saveTeamDb($r, $teamUuid, $teamDb);
$this->_rspOk();
}