This commit is contained in:
aozhiwei 2023-09-25 15:32:50 +08:00
parent d86af0711b
commit d761bafcd3
2 changed files with 24 additions and 10 deletions

View File

@ -69,8 +69,8 @@ class BaseAuthedController extends BaseController {
$this->accountId = $accountId;
$this->mysqlConn = null;
$r = $this->_getRedis($this->_getAccountId());
$myself->sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId());
return !empty($myself->sessionId);
$this->sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId());
return !empty($this->sessionId);
}
public function _handlePre()

View File

@ -335,10 +335,16 @@ class BattleController extends BaseAuthedController {
error_log($rawData);
$sign = strstr($rawData, '|', true);
$customData = strstr($rawData, '|');
$customData = substr($customData, 1);
error_log(json_encode(array(
'sign' => $sign,
'customData' => $customData
)));
if (md5($customData . HALL_KEY) != $sign) {
myself()->_rspErr(1, 'sign error');
return;
}
$customData = json_decode($customData, true);
}
$zoneId = $customData['zone_id'];
@ -351,11 +357,16 @@ class BattleController extends BaseAuthedController {
'zone_id' => $zoneId,
'node_id' => $nodeId,
'room_uuid' => $roomUuid,
'members' => array()
'start_time' => $startTime,
'team_list' => array()
);
$currSeason = mt\RankSeason::getCurrentSeason();
foreach ($customData['members'] as $team) {
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);
@ -381,14 +392,14 @@ class BattleController extends BaseAuthedController {
$chipPageDb = ChipPage::find($userPresetInfo['presetInfo']['chip_page']);
$info['chip_page'] = ChipPage::toDtoBattle($chipPageDb);
$info['honor_info'] = $userPresetInfo['honor_info'];
$battleDb = Battle::find($account_id);
$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($account_id,$info['hero_uniid']);
$heroDb = Hero::findByAccountId($accountId,$info['hero_uniid']);
if ($heroDb) {
$info['is_valid_battle'] = 1;
$info['hero_dto'] = Hero::toDto($heroDb);
@ -398,7 +409,7 @@ class BattleController extends BaseAuthedController {
}
{
$itemDb = Bag::findEx($account_id, V_ITEM_REVIVE_COIN);
$itemDb = Bag::findEx($accountId, V_ITEM_REVIVE_COIN);
$info['revive_coin'] = $itemDb && $itemDb['item_num'] > 0 ? $itemDb['item_num'] : 0;
}
@ -409,9 +420,11 @@ class BattleController extends BaseAuthedController {
}
}
}
array_push($data['members'], $info);
array_push($teamInfo['members'], $info);
}
array_push($data['team_list'], $teamInfo);
}
error_log(json_encode($data));
myself()->_rspData($data);
}
@ -419,11 +432,11 @@ class BattleController extends BaseAuthedController {
{
$accountId = myself()->_getAccountId();
$sessionId = myself()->_getSessionId();
$battleUuuid = '';
$battleUuid = '';
$currentGetStar = myself()->_getDailyV(TN_DAILY_GET_STAR_NUM, 0);
$info = array(
'account_id' => $accountId,
'session_id' => $sessionIid,
'session_id' => $sessionId,
'battle_uuid' => $battleUuid,
'current_get_star' => $currentGetStar,
'elo' => 0,
@ -448,6 +461,7 @@ class BattleController extends BaseAuthedController {
'errcode' => 0,
'errmsg' => '',
);
return $info;
}
public function getBattleDataNew()