This commit is contained in:
aozhiwei 2024-08-21 13:29:46 +08:00
parent 0708e39c49
commit 07eb1d13d9

View File

@ -673,6 +673,94 @@ class BattleController extends BaseAuthedController {
myself()->_rspData($data);
}
private function getNormalBattleDataTest($customData)
{
$sign = '';
$zoneId = 1;
$nodeId = 1;
$modeId = 1;
$mapId = 1;
$roomUuid = '';
$startTime = myself()->_getNowTime();
$currSession = null;
$data = array(
'sign' => $sign,
'zone_id' => $zoneId,
'node_id' => $nodeId,
'mode_id' => $modeId,
'map_id' => $mapId,
'room_uuid' => $roomUuid,
'start_time' => $startTime,
'match_mode' => $currSeason ? 1 : 0,
'team_list' => array()
);
foreach ($customData['team_list'] as $team) {
$teamInfo = array(
'team_uuid' => $team['team_uuid'],
'members' => array()
);
foreach ($team['members'] 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['head_id'] = $userDb['head_id'];
$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'];
$info['total_lucky'] = Hero::getAccountLuckyTemp();
$chipPageDb = ChipPage::find($userPresetInfo['hero_uniId']);
$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,$member['hero_uniid']);
if ($heroDb) {
$info['is_valid_battle'] = 1;
$info['hero_dto'] = Hero::toDto($heroDb);
$info['hero_dto']['chip_page'] = ChipPage::toDtoBattle($chipPageDb);
} 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($teamInfo['members'], $info);
}
array_push($data['team_list'], $teamInfo);
}
myself()->_rspData($data);
}
public function getNormalBattleData()
{
$version = getReqVal('version', 0);
@ -693,6 +781,12 @@ class BattleController extends BaseAuthedController {
'sign' => $sign,
'customData' => $customData
)));
if (SERVER_ENV != _ONLINE) {
if ($sign == 'ihCQQdNzoYFC^6q4ohsao39br%Ui!C9u2d^qvzek5hOB$3q1') {
$this->getNormalBattleDataTest(json_decode($customData, true));
return;
}
}
if (md5($customData . MATCH_KEY) != $sign) {
myself()->_rspErr(1, 'sign error');
return;