1
This commit is contained in:
parent
81792ef087
commit
f436306efe
@ -19,6 +19,7 @@ require_once('services/FormulaService.php');
|
|||||||
require_once('mt/RankSeason.php');
|
require_once('mt/RankSeason.php');
|
||||||
require_once('mt/ServerTask.php');
|
require_once('mt/ServerTask.php');
|
||||||
require_once('mt/ServerTaskTime.php');
|
require_once('mt/ServerTaskTime.php');
|
||||||
|
require_once('mt/Robot.php');
|
||||||
|
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
use models\Hero;
|
use models\Hero;
|
||||||
@ -482,7 +483,7 @@ class BattleController extends BaseAuthedController {
|
|||||||
if ($ignoreAndroid) {
|
if ($ignoreAndroid) {
|
||||||
$isAllAndroid = true;
|
$isAllAndroid = true;
|
||||||
foreach ($team['members'] as $member) {
|
foreach ($team['members'] as $member) {
|
||||||
if ($member['is_android']) {
|
if (!$member['is_android']) {
|
||||||
$isAllAndroid = false;
|
$isAllAndroid = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -499,60 +500,65 @@ class BattleController extends BaseAuthedController {
|
|||||||
if ($ignoreAndroid && $member['is_android']) {
|
if ($ignoreAndroid && $member['is_android']) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$accountId = $member['account_id'];
|
if ($member['is_android']) {
|
||||||
$switchOk = $this->switchOnlineAccount($accountId);
|
$info = $this->getAndroidInfo($member);
|
||||||
if (!$switchOk) {
|
array_push($teamInfo['members'], $info);
|
||||||
myself()->_rspErr(1, 'data error');
|
} else {
|
||||||
return;
|
$accountId = $member['account_id'];
|
||||||
}
|
$switchOk = $this->switchOnlineAccount($accountId);
|
||||||
$info = $this->genInitBattleData();
|
if (!$switchOk) {
|
||||||
$userDb = User::find($accountId);
|
myself()->_rspErr(1, 'data error');
|
||||||
if ($userDb) {
|
return;
|
||||||
$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'];
|
|
||||||
$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);
|
|
||||||
}
|
}
|
||||||
|
$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'];
|
||||||
|
$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']);
|
$heroDb = Hero::findByAccountId($accountId,$info['hero_uniid']);
|
||||||
if ($heroDb) {
|
if ($heroDb) {
|
||||||
$info['is_valid_battle'] = 1;
|
$info['is_valid_battle'] = 1;
|
||||||
$info['hero_dto'] = Hero::toDto($heroDb);
|
$info['hero_dto'] = Hero::toDto($heroDb);
|
||||||
} else {
|
} else {
|
||||||
$info['errcode'] = 51;
|
$info['errcode'] = 51;
|
||||||
$info['errmsg'] = 'paramater error';
|
$info['errmsg'] = 'paramater error';
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
$itemDb = Bag::findEx($accountId, V_ITEM_REVIVE_COIN);
|
$itemDb = Bag::findEx($accountId, V_ITEM_REVIVE_COIN);
|
||||||
$info['revive_coin'] = $itemDb && $itemDb['item_num'] > 0 ? $itemDb['item_num'] : 0;
|
$info['revive_coin'] = $itemDb && $itemDb['item_num'] > 0 ? $itemDb['item_num'] : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
$info['match_mode'] = 0;
|
$info['match_mode'] = 0;
|
||||||
if ($currSeason){
|
if ($currSeason){
|
||||||
$info['match_mode'] = 1;
|
$info['match_mode'] = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
array_push($teamInfo['members'], $info);
|
||||||
}
|
}
|
||||||
array_push($teamInfo['members'], $info);
|
|
||||||
}
|
}
|
||||||
array_push($data['team_list'], $teamInfo);
|
array_push($data['team_list'], $teamInfo);
|
||||||
}
|
}
|
||||||
@ -847,4 +853,24 @@ class BattleController extends BaseAuthedController {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function getAndroidInfo($member)
|
||||||
|
{
|
||||||
|
$robotMeta = mt\Robot::get($member['robot_id']);
|
||||||
|
$info = array(
|
||||||
|
'account_id' => $member['account_id'],
|
||||||
|
'name' => $member['name'],
|
||||||
|
'is_valid_battle' => 1,
|
||||||
|
'errcode' => 0,
|
||||||
|
'errmsg' => '',
|
||||||
|
'level' => 1,
|
||||||
|
'is_android' => 1,
|
||||||
|
'robot_id' => $member['robot_id'],
|
||||||
|
'hero_dto' => array(
|
||||||
|
'hero_uniid' => '',
|
||||||
|
'hero_id' => $robotMeta['hero_id']
|
||||||
|
)
|
||||||
|
);
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ class Robot {
|
|||||||
protected static function getMetaList()
|
protected static function getMetaList()
|
||||||
{
|
{
|
||||||
if (!self::$metaList) {
|
if (!self::$metaList) {
|
||||||
self::$metaList = getMetaTable('robot@robot1.php');
|
self::$metaList = getMetaTable('robot@robot.php');
|
||||||
}
|
}
|
||||||
return self::$metaList;
|
return self::$metaList;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user