1
This commit is contained in:
parent
5bd14c4822
commit
f52ccf60c5
@ -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,
|
||||
@ -215,6 +216,25 @@ class TeamController extends BaseAuthedController {
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function breakup(){
|
||||
$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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
$this->delTeamDb($r, $teamUuid);
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
|
||||
public function kickout()
|
||||
{
|
||||
$teamUuid = getReqVal('team_uuid', '');
|
||||
@ -427,130 +447,6 @@ class TeamController extends BaseAuthedController {
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function setHero(){
|
||||
$teamUuid = getReqVal('team_uuid', '');
|
||||
$heroUid = getReqVal('hero_uid', '');
|
||||
$heroDb = Hero::find($heroUid);
|
||||
if (! $heroDb){
|
||||
$this->_rspErr(1, 'hero_uid param error');
|
||||
return;
|
||||
}
|
||||
$r = $this->_getRedis($teamUuid);
|
||||
$teamDb = $this->readTeamDb($r, $teamUuid);
|
||||
if (empty($teamDb)) {
|
||||
$this->_rspErr(1, 'The team has been disbanded');
|
||||
return;
|
||||
}
|
||||
$this->_updateUserInfo(array(
|
||||
'hero_id' => $heroUid
|
||||
));
|
||||
$newUserInfo = User::toPreset($this->_getOrmUserInfo());
|
||||
foreach ($teamDb['member_list'] as &$member) {
|
||||
if ($member['account_id'] == $this->_getAccountId()){
|
||||
$newUserInfo['is_leader'] = $member['is_leader'];
|
||||
$newUserInfo['is_ready'] = $member['is_ready'];
|
||||
$member = $newUserInfo;
|
||||
}
|
||||
|
||||
}
|
||||
$this->saveTeamDb($r, $teamUuid, $teamDb);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addUserChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto()
|
||||
));
|
||||
}
|
||||
|
||||
public function setPreset(){
|
||||
$teamUuid = getReqVal('team_uuid', '');
|
||||
$heroId = getReqVal('hero_uid',0);
|
||||
$chipPageId = getReqVal('chip_page',0);
|
||||
$weaponUid1 = getReqVal('weapon_uid1',0);
|
||||
$weaponUid2 = getReqVal('weapon_uid2',0);
|
||||
$skillId = getReqVal('skill_id',0);
|
||||
$r = $this->_getRedis($teamUuid);
|
||||
$teamDb = $this->readTeamDb($r, $teamUuid);
|
||||
if (empty($teamDb)) {
|
||||
$this->_rspErr(1, 'The team has been disbanded');
|
||||
return;
|
||||
}
|
||||
$heroDb = Hero::find($heroId);
|
||||
if (! $heroDb){
|
||||
$this->_rspErr(1, "You don't have the hero yet");
|
||||
return;
|
||||
}
|
||||
$chipPageDb = ChipPage::find($chipPageId);
|
||||
if (! $chipPageDb){
|
||||
$this->_rspErr(1, "You don't have the chip page");
|
||||
return;
|
||||
}
|
||||
if ($weaponUid1){
|
||||
$gunDb1 = Gun::find($weaponUid1);
|
||||
if (!$gunDb1){
|
||||
$this->_rspErr(1, "You don't have the gun1 yet");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ($weaponUid2){
|
||||
$gunDb2 = Gun::find($weaponUid2);
|
||||
if (!$gunDb2){
|
||||
$this->_rspErr(1, "You don't have the gun2 yet");
|
||||
return;
|
||||
}
|
||||
}
|
||||
$skillMeta = mt\Skill::get($skillId);
|
||||
if (! $skillMeta){
|
||||
$this->_rspErr(1,'skill_id parameter error');
|
||||
return ;
|
||||
}
|
||||
HeroPreset::upsertPreset($heroId,$skillId,$chipPageId,$weaponUid1,$weaponUid2);
|
||||
$newUserInfo = User::toPreset($this->_getOrmUserInfo());
|
||||
foreach ($teamDb['member_list'] as &$member) {
|
||||
if ($member['account_id'] == $this->_getAccountId()){
|
||||
$newUserInfo['is_leader'] = $member['is_leader'];
|
||||
$newUserInfo['is_ready'] = $member['is_ready'];
|
||||
$member = $newUserInfo;
|
||||
}
|
||||
|
||||
}
|
||||
$this->saveTeamDb($r, $teamUuid, $teamDb);
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function setHeroSkin(){
|
||||
$teamUuid = getReqVal('team_uuid', '');
|
||||
$heroUniId = getReqVal('hero_uid', 0);
|
||||
$skinId = getReqVal('skin_id', 0);
|
||||
$r = $this->_getRedis($teamUuid);
|
||||
$teamDb = $this->readTeamDb($r, $teamUuid);
|
||||
if (empty($teamDb)) {
|
||||
$this->_rspErr(1, 'The team has been disbanded');
|
||||
return;
|
||||
}
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
$heroSkinDb = HeroSkin::find($skinId);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(1, "You don't have the hero yet");
|
||||
return;
|
||||
}
|
||||
if (!$heroSkinDb) {
|
||||
$this->_rspErr(2, "You don't have the skin yet");
|
||||
return;
|
||||
}
|
||||
HeroSkin::takeonSkin( $skinId,$heroDb['hero_id']);
|
||||
$newUserInfo = User::toPreset($this->_getOrmUserInfo());
|
||||
foreach ($teamDb['member_list'] as &$member) {
|
||||
if ($member['account_id'] == $this->_getAccountId()){
|
||||
$newUserInfo['is_leader'] = $member['is_leader'];
|
||||
$newUserInfo['is_ready'] = $member['is_ready'];
|
||||
$member = $newUserInfo;
|
||||
}
|
||||
|
||||
}
|
||||
$this->saveTeamDb($r, $teamUuid, $teamDb);
|
||||
$this->_rspOk();
|
||||
}
|
||||
|
||||
public function getPveFragmentNumOrDay(){
|
||||
$todayPveGetHeroFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_HERO_FRAGMENT_NUM, 0);
|
||||
$todayPveGetGunFragmentNum = myself()->_getDailyV(TN_DAILY_PVE_GET_GUN_FRAGMENT_NUM, 0);
|
||||
@ -560,6 +456,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)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user