添加观战队伍

This commit is contained in:
aozhiwei 2024-02-04 17:17:26 +08:00
parent 4608116a70
commit 4ee4433889

View File

@ -363,7 +363,8 @@ class BattleController extends BaseAuthedController {
'node_id' => $nodeId,
'room_uuid' => $roomUuid,
'start_time' => $startTime,
'team_list' => array()
'team_list' => array(),
'ob_list' => array()
);
$currSeason = mt\RankSeason::getCurrentSeason();
@ -429,6 +430,61 @@ class BattleController extends BaseAuthedController {
}
array_push($data['team_list'], $teamInfo);
}
foreach ($customData['ob_list'] as $member) {
$accountId = $member['account_id'];
$switchOk = $this->switchOnlineAccount($accountId);
if (!$switchOk) {
myself()->_rspErr(1, 'data error');
return;
}
$info = $this->genInitBattleData();
$userDb = User::find($accountId);
if ($userDb) {
$userPresetInfo = User::toPreset($userDb);
$info['elo'] = $userDb['elo'];
$info['rank'] = $userDb['rank'];
$info['name'] = $userPresetInfo['name'];
$info['level'] = $userPresetInfo['level'];
$info['parachute'] = $userPresetInfo['parachute'];
$info['hero_uniid'] = $userPresetInfo['hero_uniId'];
$info['hero_id'] = $userPresetInfo['hero_id'];
$info['hero_skin'] = $userPresetInfo['hero_skin'];
$info['skill_id'] = $userPresetInfo['presetInfo']['skill_id'];
$info['weapon_uuid1'] = $userPresetInfo['presetInfo']['weapon_uid1'];
$info['weapon_uuid2'] = $userPresetInfo['presetInfo']['weapon_uid2'];
$chipPageDb = ChipPage::find($userPresetInfo['hero_uniId']);
$info['chip_page'] = ChipPage::toDtoBattle($chipPageDb);
$info['honor_info'] = $userPresetInfo['honor_info'];
$battleDb = Battle::find($accountId);
if ($battleDb){
$battleData = json_decode($battleDb['battle_data'], true);
$seasonBattleData = isset($battleData) ? getXVal($battleData, 'data', array()) : array();
$info['battle_times'] = getXVal($seasonBattleData, 'total_battle_times', 0);
}
$heroDb = Hero::findByAccountId($accountId,$info['hero_uniid']);
if ($heroDb) {
$info['is_valid_battle'] = 1;
$info['hero_dto'] = Hero::toDto($heroDb);
} else {
$info['errcode'] = 51;
$info['errmsg'] = 'paramater error';
}
{
$itemDb = Bag::findEx($accountId, V_ITEM_REVIVE_COIN);
$info['revive_coin'] = $itemDb && $itemDb['item_num'] > 0 ? $itemDb['item_num'] : 0;
}
{
$info['match_mode'] = 0;
if ($currSeason){
$info['match_mode'] = 1;
}
}
}
array_push($data['ob_list'], $info);
}
error_log(json_encode($data));
myself()->_rspData($data);
}