Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
86c60d3a7b
@ -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;
|
||||||
@ -435,6 +436,11 @@ class BattleController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function getNormalBattleData()
|
public function getNormalBattleData()
|
||||||
{
|
{
|
||||||
|
$version = getReqVal('version', 0);
|
||||||
|
$ignoreAndroid = false;
|
||||||
|
if ($version < 1) {
|
||||||
|
$ignoreAndroid = true;
|
||||||
|
}
|
||||||
$sign = '';
|
$sign = '';
|
||||||
$customData = array();
|
$customData = array();
|
||||||
{
|
{
|
||||||
@ -474,11 +480,30 @@ class BattleController extends BaseAuthedController {
|
|||||||
|
|
||||||
$currSeason = mt\RankSeason::getCurrentSeason();
|
$currSeason = mt\RankSeason::getCurrentSeason();
|
||||||
foreach ($customData['team_list'] as $team) {
|
foreach ($customData['team_list'] as $team) {
|
||||||
|
if ($ignoreAndroid) {
|
||||||
|
$isAllAndroid = true;
|
||||||
|
foreach ($team['members'] as $member) {
|
||||||
|
if (!$member['is_android']) {
|
||||||
|
$isAllAndroid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($isAllAndroid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
$teamInfo = array(
|
$teamInfo = array(
|
||||||
'team_uuid' => $team['team_uuid'],
|
'team_uuid' => $team['team_uuid'],
|
||||||
'members' => array()
|
'members' => array()
|
||||||
);
|
);
|
||||||
foreach ($team['members'] as $member) {
|
foreach ($team['members'] as $member) {
|
||||||
|
if ($ignoreAndroid && $member['is_android']) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($member['is_android']) {
|
||||||
|
$info = $this->getAndroidInfo($member);
|
||||||
|
array_push($teamInfo['members'], $info);
|
||||||
|
} else {
|
||||||
$accountId = $member['account_id'];
|
$accountId = $member['account_id'];
|
||||||
$switchOk = $this->switchOnlineAccount($accountId);
|
$switchOk = $this->switchOnlineAccount($accountId);
|
||||||
if (!$switchOk) {
|
if (!$switchOk) {
|
||||||
@ -491,6 +516,7 @@ class BattleController extends BaseAuthedController {
|
|||||||
$userPresetInfo = User::toPreset($userDb);
|
$userPresetInfo = User::toPreset($userDb);
|
||||||
$info['elo'] = $userDb['elo'];
|
$info['elo'] = $userDb['elo'];
|
||||||
$info['rank'] = $userDb['rank'];
|
$info['rank'] = $userDb['rank'];
|
||||||
|
$info['head_id'] = $userDb['head_id'];
|
||||||
$info['name'] = $userPresetInfo['name'];
|
$info['name'] = $userPresetInfo['name'];
|
||||||
$info['level'] = $userPresetInfo['level'];
|
$info['level'] = $userPresetInfo['level'];
|
||||||
$info['parachute'] = $userPresetInfo['parachute'];
|
$info['parachute'] = $userPresetInfo['parachute'];
|
||||||
@ -533,6 +559,7 @@ class BattleController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
array_push($teamInfo['members'], $info);
|
array_push($teamInfo['members'], $info);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
array_push($data['team_list'], $teamInfo);
|
array_push($data['team_list'], $teamInfo);
|
||||||
}
|
}
|
||||||
error_log(json_encode($data));
|
error_log(json_encode($data));
|
||||||
@ -826,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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ class UserController extends BaseAuthedController {
|
|||||||
'is_moba' => 0,
|
'is_moba' => 0,
|
||||||
'is_open' => 0
|
'is_open' => 0
|
||||||
);
|
);
|
||||||
if (empty($mapId)) {
|
if (!empty($mapId)) {
|
||||||
$mapMeta = mt\Map::get($mapId);
|
$mapMeta = mt\Map::get($mapId);
|
||||||
if ($mapMeta) {
|
if ($mapMeta) {
|
||||||
$mapInfo = $mapMeta;
|
$mapInfo = $mapMeta;
|
||||||
@ -480,7 +480,7 @@ class UserController extends BaseAuthedController {
|
|||||||
'is_moba' => 0,
|
'is_moba' => 0,
|
||||||
'is_open' => 0
|
'is_open' => 0
|
||||||
);
|
);
|
||||||
if (empty($mapId)) {
|
if (!empty($mapId)) {
|
||||||
$mapMeta = mt\Map::get($mapId);
|
$mapMeta = mt\Map::get($mapId);
|
||||||
if ($mapMeta) {
|
if ($mapMeta) {
|
||||||
$mapInfo = $mapMeta;
|
$mapInfo = $mapMeta;
|
||||||
@ -513,7 +513,7 @@ class UserController extends BaseAuthedController {
|
|||||||
'info' => array(
|
'info' => array(
|
||||||
'user_info' => $userInfo,
|
'user_info' => $userInfo,
|
||||||
'hero_info' => $heroInfo,
|
'hero_info' => $heroInfo,
|
||||||
'map_info' => $mapMeta
|
'map_info' => $mapInfo
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -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