Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
a74e772bb6
@ -137,6 +137,9 @@ class Battle(object):
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['sign', '', '签名'],
|
||||
['zone_id', '', 'zone_id'],
|
||||
['node_id', '', 'node_id'],
|
||||
['start_time', '', 'start_time'],
|
||||
['room_uuid', '', '房间id'],
|
||||
['!team_list', [_common.BattleTeam()], '队伍数据'],
|
||||
]
|
||||
|
@ -65,6 +65,14 @@ class BaseAuthedController extends BaseController {
|
||||
$this->mysqlConn = null;
|
||||
}
|
||||
|
||||
public function switchOnlineAccount($accountId){
|
||||
$this->accountId = $accountId;
|
||||
$this->mysqlConn = null;
|
||||
$r = $this->_getRedis($this->_getAccountId());
|
||||
$myself->sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId());
|
||||
return !empty($myself->sessionId);
|
||||
}
|
||||
|
||||
public function _handlePre()
|
||||
{
|
||||
// if (SERVER_ENV == _ONLINE) {
|
||||
|
@ -341,48 +341,31 @@ class BattleController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
|
||||
$zoneId = $customData['zone_id'];
|
||||
$nodeId = $customData['node_id'];
|
||||
$roomUuid = $customData['room_uuid'];
|
||||
$startTime = $customData['start_time'];
|
||||
|
||||
$data = array(
|
||||
'sign' => $sign,
|
||||
'zone_id' => $zoneId,
|
||||
'node_id' => $nodeId,
|
||||
'room_uuid' => $roomUuid,
|
||||
'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){
|
||||
$currSeason = mt\RankSeason::getCurrentSeason();
|
||||
foreach ($customData['members'] as $team) {
|
||||
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'];
|
||||
@ -405,13 +388,6 @@ class BattleController extends BaseAuthedController {
|
||||
$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;
|
||||
@ -420,18 +396,6 @@ class BattleController extends BaseAuthedController {
|
||||
$info['errcode'] = 51;
|
||||
$info['errmsg'] = 'paramater error';
|
||||
}
|
||||
}
|
||||
|
||||
// {
|
||||
// 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);
|
||||
@ -446,9 +410,46 @@ class BattleController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
array_push($data['members'], $info);
|
||||
}
|
||||
}
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
private function genInitBattleData()
|
||||
{
|
||||
$accountId = myself()->_getAccountId();
|
||||
$sessionId = myself()->_getSessionId();
|
||||
$battleUuuid = '';
|
||||
$currentGetStar = myself()->_getDailyV(TN_DAILY_GET_STAR_NUM, 0);
|
||||
$info = array(
|
||||
'account_id' => $accountId,
|
||||
'session_id' => $sessionIid,
|
||||
'battle_uuid' => $battleUuid,
|
||||
'current_get_star' => $currentGetStar,
|
||||
'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' => '',
|
||||
);
|
||||
}
|
||||
|
||||
public function getBattleDataNew()
|
||||
{
|
||||
error_log(json_encode($_REQUEST));
|
||||
|
Loading…
x
Reference in New Issue
Block a user