This commit is contained in:
aozhiwei 2023-09-21 15:21:35 +08:00
parent 5adccded43
commit 20f9bbfea1
2 changed files with 121 additions and 2 deletions

View File

@ -125,6 +125,7 @@ class Battle(object):
]
},
{
'method': 'POST',
'desc': '获取战斗数据(客户端不用处理)getCustomBattleData',
'group': 'Battle',
'url': 'webapp/index.php?c=Battle&a=getCustomBattleData',
@ -132,13 +133,12 @@ class Battle(object):
_common.ReqHead(),
['account_id', '', 'account_id'],
['session_id', '', 'session_id'],
['battle_uuid', '', 'battle_uuid'],
],
'response': [
_common.RspHead(),
['sign', '', '签名'],
['room_uuid', '', '房间id'],
['!team_list', _common.BattleTeam(), '队伍数据'],
['!team_list', [_common.BattleTeam()], '队伍数据'],
]
},
{

View File

@ -299,6 +299,125 @@ class BattleController extends BaseAuthedController {
}
}
// {
// for ($i = 1; $i <= 2; ++$i) {
// if (isset($info['weapon_uuid' . $i])) {
// $gunDb = Gun::findByAccountId($account_id, $info['weapon_uuid' . $i]);
// if ($gunDb) {
// $info['weapon_dto' . $i] = Gun::toDto($gunDb);
// }
// }
// }
// }
{
$itemDb = Bag::findEx($account_id, 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['members'], $info);
myself()->_rspData($data);
}
public function getCustomBattleData()
{
$sign = '';
$customData = array();
{
$rawData = file_get_contents('php://input');
error_log($rawData);
$sign = strstr($rawData, '|', true);
$customData = strstr($rawData, '|');
}
$data = array(
'members' => array()
);
$currSeason = mt\RankSeason::getCurrentSeason();
$account_id = getReqVal('account_id', '');
$session_id = getReqVal('session_id', '');
$battle_uuid = getReqVal('battle_uuid', '');
$current_get_star = myself()->_getDailyV(TN_DAILY_GET_STAR_NUM, 0);
$info = array(
'account_id' => $account_id,
'session_id' => $session_id,
'battle_uuid' => $battle_uuid,
'current_get_star' => $current_get_star,
'elo' => 0,
'rank' => 0,
'name' => '',
'level' =>'',
'hero_uniid' => '',
'hero_id' => '',
'weapon_uuid1' => '',
'weapon_uuid2' => '',
'parachute' => '',
'hero_skin' => '',
'skill_id' => '',
'chip_page' => array(),
'battle_times' => '',
'hero_dto' => '',
'weapon_dto1' => '',
'weapon_dto2' => '',
'is_valid_battle' => 0,
//'payload' => json_encode($member['cmjoin']),
'errcode' => 0,
'errmsg' => '',
);
if (!phpcommon\isValidSessionId($account_id, $session_id)) {
$info['errcode'] = 50;
$info['errmsg'] = 'invalid session_id';
}else{
{
$userDb = User::find($account_id);
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['presetInfo']['chip_page']);
$info['chip_page'] = ChipPage::toDtoBattle($chipPageDb);
$info['honor_info'] = $userPresetInfo['honor_info'];
$battleDb = Battle::find($account_id);
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);
}
}else{
$info['errcode'] = 51;
$info['errmsg'] = 'paramater error';
}
}
{
$heroDb = Hero::findByAccountId($account_id,$info['hero_uniid']);
if ($heroDb) {
$info['is_valid_battle'] = 1;
$info['hero_dto'] = Hero::toDto($heroDb);
} else {
$info['errcode'] = 51;
$info['errmsg'] = 'paramater error';
}
}
// {
// for ($i = 1; $i <= 2; ++$i) {
// if (isset($info['weapon_uuid' . $i])) {