1
This commit is contained in:
commit
c0cb1f538f
@ -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)
|
||||
{
|
||||
|
@ -220,7 +220,8 @@ class User extends BaseModel {
|
||||
'current_star_num' => $current_star_num,
|
||||
'next_star_num' => $next_star_num,
|
||||
// 'status_bar' => self::_getState(),
|
||||
'honor_info' => $honorInfo
|
||||
'honor_info' => $honorInfo,
|
||||
'last_login_time' => $row['last_login_time'],
|
||||
);
|
||||
}
|
||||
|
||||
@ -292,9 +293,9 @@ class User extends BaseModel {
|
||||
'account_id' => $row['account_id'],
|
||||
'address' => $row['address'],
|
||||
'name' => $row['name'],
|
||||
// 'sex' => $row['sex'],
|
||||
// 'head_id' => $row['head_id'],
|
||||
// 'head_frame' => $row['head_frame'],
|
||||
'sex' => $row['sex'],
|
||||
'head_id' => $row['head_id'],
|
||||
'head_frame' => $row['head_frame'],
|
||||
'level' => $row['level'],
|
||||
'exp' => $row['exp'],
|
||||
'rank' => $row['rank'],
|
||||
|
@ -9,7 +9,7 @@ class NumberService extends BaseService
|
||||
public static function ceilEx($number , $decimals) {
|
||||
$intPart = intval($number);
|
||||
$floatPart = $number - $intPart;
|
||||
$finallyFloatPart = ceil($floatPart * pow(10,$decimals)) / pow(10,$decimals);
|
||||
$finallyFloatPart = ceil(strval($floatPart * pow(10,$decimals))) / pow(10,$decimals);
|
||||
return $intPart + $finallyFloatPart;
|
||||
}
|
||||
}
|
@ -866,8 +866,8 @@ class TameBattleDataService extends BaseService {
|
||||
'rank' => $newRank,
|
||||
'score' => $newScore,
|
||||
'elo' => $newElo,
|
||||
'history_best_rank' => max($this->userInfo['rank'], $newRank),
|
||||
'history_best_score' => max($this->userInfo['score'], $newScore),
|
||||
'history_best_rank' => max($this->userInfo['history_best_rank'], $newRank),
|
||||
'history_best_score' => max($this->userInfo['history_best_score'], $newScore),
|
||||
'score_modifytime' => myself()->_getNowTime(),
|
||||
'best_rank_modifytime' => $newRank > $this->userInfo['rank'] ?
|
||||
myself()->_getNowTime() : $this->userInfo['best_rank_modifytime'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user