From 4ee44338896a687d6e6dbaae08010f41732dac31 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sun, 4 Feb 2024 17:17:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=A7=82=E6=88=98=E9=98=9F?= =?UTF-8?q?=E4=BC=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/controller/BattleController.class.php | 58 +++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 55f328fc..0573b813 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -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); }