1
This commit is contained in:
commit
d4e3a8bb1b
@ -533,4 +533,24 @@ class AAMarket(object):
|
||||
['!rows', [_common.RechargeHistory()], '数据'],
|
||||
]
|
||||
},
|
||||
{
|
||||
'method': 'GET',
|
||||
'name': '/api/server_switch',
|
||||
'desc': '获取功能开关',
|
||||
'group': '!AAMarket',
|
||||
'url': 'https://market-test.kingsome.cn/api/server_switch',
|
||||
'params': [
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['data', [
|
||||
['heroChain',0,'英雄上链'],
|
||||
['heroUp',0,'英雄升阶'],
|
||||
['goldSyn',0,'金币合成'],
|
||||
['heroPieceSyn',0,'英雄碎片合成'],
|
||||
['chipPieceSyn',0,'芯片碎片合成'],
|
||||
['shop',0,'商店'],
|
||||
], '开关信息(如果没有则默认为未开启)'],
|
||||
]
|
||||
},
|
||||
]
|
||||
|
@ -516,6 +516,9 @@ class BagController extends BaseAuthedController {
|
||||
{
|
||||
$itemId = getReqVal('item_id', 0);
|
||||
$itemNum = getReqVal('item_num', 1);
|
||||
if ($itemId == 900006) {
|
||||
myself()->_verifySwitch('bountyMode.buyTicket');
|
||||
}
|
||||
$itemMeta = mt\Item::get($itemId);
|
||||
if (!$itemMeta) {
|
||||
$this->_rspErr(1, "item_id error");
|
||||
|
@ -67,13 +67,18 @@ class BaseAuthedController extends BaseController {
|
||||
|
||||
public function switchAccount($accountId){
|
||||
$this->accountId = $accountId;
|
||||
$this->address = null;
|
||||
$this->addressActived = false;
|
||||
$this->mysqlConn = null;
|
||||
$this->redisConn = null;
|
||||
}
|
||||
|
||||
public function switchOnlineAccount($accountId){
|
||||
$this->accountId = $accountId;
|
||||
$this->address = null;
|
||||
$this->addressActived = false;
|
||||
$this->mysqlConn = null;
|
||||
$this->redisConn = null;
|
||||
$r = $this->_getRedis($this->_getAccountId());
|
||||
$this->sessionId = $r->get(LAST_SESSION_KEY . $this->_getAccountId());
|
||||
return !empty($this->sessionId);
|
||||
|
@ -410,6 +410,10 @@ class BaseController {
|
||||
myself()->_callServiceStatic('ServerSwitchService', 'verifySwitch', $name);
|
||||
}
|
||||
|
||||
public static function _switchIsOpen($name) {
|
||||
return myself()->_callServiceStatic('ServerSwitchService', 'switchIsOpen', $name);
|
||||
}
|
||||
|
||||
public function _mergeAlikeItemKey($items){
|
||||
$hashItems = array();
|
||||
foreach ($items as $item){
|
||||
|
@ -673,6 +673,94 @@ class BattleController extends BaseAuthedController {
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
private function getNormalBattleDataTest($customData)
|
||||
{
|
||||
$sign = '';
|
||||
$zoneId = 1;
|
||||
$nodeId = 1;
|
||||
$modeId = 1;
|
||||
$mapId = 1;
|
||||
$roomUuid = '';
|
||||
$startTime = myself()->_getNowTime();
|
||||
$currSession = null;
|
||||
$data = array(
|
||||
'sign' => $sign,
|
||||
'zone_id' => $zoneId,
|
||||
'node_id' => $nodeId,
|
||||
'mode_id' => $modeId,
|
||||
'map_id' => $mapId,
|
||||
'room_uuid' => $roomUuid,
|
||||
'start_time' => $startTime,
|
||||
'match_mode' => $currSeason ? 1 : 0,
|
||||
'team_list' => array()
|
||||
);
|
||||
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);
|
||||
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'];
|
||||
$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'];
|
||||
$info['total_lucky'] = Hero::getAccountLuckyTemp();
|
||||
$chipPageDb = ChipPage::find($userPresetInfo['hero_uniId']);
|
||||
$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,$member['hero_uniid']);
|
||||
if ($heroDb) {
|
||||
$info['is_valid_battle'] = 1;
|
||||
$info['hero_dto'] = Hero::toDto($heroDb);
|
||||
$info['hero_dto']['chip_page'] = ChipPage::toDtoBattle($chipPageDb);
|
||||
} else {
|
||||
$info['errcode'] = 51;
|
||||
$info['errmsg'] = 'paramater error';
|
||||
}
|
||||
|
||||
{
|
||||
$itemDb = Bag::findEx($accountId, 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($teamInfo['members'], $info);
|
||||
}
|
||||
array_push($data['team_list'], $teamInfo);
|
||||
}
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
public function getNormalBattleData()
|
||||
{
|
||||
$version = getReqVal('version', 0);
|
||||
@ -693,6 +781,12 @@ class BattleController extends BaseAuthedController {
|
||||
'sign' => $sign,
|
||||
'customData' => $customData
|
||||
)));
|
||||
if (SERVER_ENV != _ONLINE) {
|
||||
if ($sign == 'ihCQQdNzoYFC^6q4ohsao39br%Ui!C9u2d^qvzek5hOB$3q1') {
|
||||
$this->getNormalBattleDataTest(json_decode($customData, true));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (md5($customData . MATCH_KEY) != $sign) {
|
||||
myself()->_rspErr(1, 'sign error');
|
||||
return;
|
||||
@ -725,6 +819,10 @@ class BattleController extends BaseAuthedController {
|
||||
myself()->_rspErr(2, 'map mode error');
|
||||
return;
|
||||
}
|
||||
if (!mt\MapMode::isOpen($mapModeMeta)) {
|
||||
myself()->_rspErr(2, 'map mode error');
|
||||
return;
|
||||
}
|
||||
$r = myself()->_getRedis($roomUuid);
|
||||
if (!$this->checkTicket($r, $customData, $mapModeMeta)) {
|
||||
myself()->_rspErr(2, 'map mode error');
|
||||
@ -779,6 +877,7 @@ class BattleController extends BaseAuthedController {
|
||||
$info['skill_id'] = $userPresetInfo['presetInfo']['skill_id'];
|
||||
$info['weapon_uuid1'] = $userPresetInfo['presetInfo']['weapon_uid1'];
|
||||
$info['weapon_uuid2'] = $userPresetInfo['presetInfo']['weapon_uid2'];
|
||||
$info['total_lucky'] = Hero::getAccountLuckyTemp();
|
||||
$chipPageDb = ChipPage::find($userPresetInfo['hero_uniId']);
|
||||
$info['honor_info'] = $userPresetInfo['honor_info'];
|
||||
$battleDb = Battle::find($accountId);
|
||||
@ -1175,6 +1274,12 @@ class BattleController extends BaseAuthedController {
|
||||
|
||||
public function requestAllocBoxNum()
|
||||
{
|
||||
if (!myself()->_switchIsOpen('bigEventBoxDrop')) {
|
||||
myself()->_rspData(array(
|
||||
'box_num' => 0
|
||||
));
|
||||
return;
|
||||
}
|
||||
$roomUuid = getReqVal('room_uuid', '');
|
||||
$row = SqlHelper::ormSelectOne(
|
||||
$this->_getSelfMysql(),
|
||||
|
@ -175,6 +175,8 @@ class BattleDataController extends BaseAuthedController {
|
||||
$teamBattleDataService->addBattleSettlementTeam();
|
||||
foreach ($teamData['members'] as $member){
|
||||
$member['pvp_team_rank'] = getXVal($teamData,'pvp_team_rank', 0);
|
||||
$member['victory'] = getXVal($teamData,'victory', 0);
|
||||
$member['room_mode'] = getXVal($teamData,'room_mode', 0);
|
||||
if ($member['account_id'] && !myself()->_isAndroidAccountId($member['account_id'])){
|
||||
$this->switchAccount($member['account_id']);
|
||||
$teamBattleDataService->battleInfo = $member;
|
||||
@ -521,7 +523,6 @@ class BattleDataController extends BaseAuthedController {
|
||||
$customData = array();
|
||||
{
|
||||
$rawData = file_get_contents('php://input');
|
||||
|
||||
$sign = strstr($rawData, '|', true);
|
||||
$customData = strstr($rawData, '|');
|
||||
$customData = substr($customData, 1);
|
||||
@ -536,7 +537,6 @@ class BattleDataController extends BaseAuthedController {
|
||||
$customData = json_decode($customData, true);
|
||||
}
|
||||
|
||||
|
||||
$zoneId = $customData['zone_id'];
|
||||
$nodeId = $customData['node_id'];
|
||||
$roomUuid = $customData['room_uuid'];
|
||||
@ -670,7 +670,6 @@ class BattleDataController extends BaseAuthedController {
|
||||
}
|
||||
array_push($data['ob_list'], $info);
|
||||
}
|
||||
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
@ -816,7 +815,6 @@ class BattleDataController extends BaseAuthedController {
|
||||
}
|
||||
array_push($data['team_list'], $teamInfo);
|
||||
}
|
||||
|
||||
$this->decTicket($r, $customData, $mapModeMeta);
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
@ -827,7 +825,6 @@ class BattleDataController extends BaseAuthedController {
|
||||
$customData = array();
|
||||
{
|
||||
$rawData = file_get_contents('php://input');
|
||||
|
||||
$headStr = strstr($rawData, '|', true);
|
||||
$sign = strstr($headStr, ':', true);
|
||||
$customData = strstr($rawData, '|');
|
||||
@ -920,7 +917,6 @@ class BattleDataController extends BaseAuthedController {
|
||||
}
|
||||
array_push($data['team_list'], $teamInfo);
|
||||
}
|
||||
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
|
@ -353,6 +353,7 @@ class OtherController extends BaseAuthedController {
|
||||
$temp['state'] = $nowTimeOffset >= $dailyOpenTimeOffset && $nowTimeOffset <= $dailyEndTimeOffset ? 1 : 0;
|
||||
}
|
||||
|
||||
|
||||
if ($modeMeta['daily_open_time_2']){
|
||||
$dailyOpenTimeOffset = myself()->_getDaySecondsOffset(strtotime("2024-6-22 ".$modeMeta['daily_open_time_2']));
|
||||
$dailyEndTimeOffset = myself()->_getDaySecondsOffset(strtotime("2024-6-22 ".$modeMeta['daily_end_time_2']));
|
||||
@ -366,6 +367,14 @@ class OtherController extends BaseAuthedController {
|
||||
$modeList,
|
||||
$temp
|
||||
);
|
||||
|
||||
$isOpen = mt\MapMode::isOpen($modeMeta);
|
||||
if ($isOpen) {
|
||||
array_push(
|
||||
$modeList,
|
||||
$temp
|
||||
);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
@ -67,6 +67,36 @@ class MapMode
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function isOpen($meta)
|
||||
{
|
||||
if (!$meta['is_open']) {
|
||||
return false;
|
||||
}
|
||||
$isOpen = true;
|
||||
switch ($meta['mapMode']) {
|
||||
case self::GOLD_MODE:
|
||||
{
|
||||
$isOpen = myself()->_switchIsOpen('goldMode');
|
||||
}
|
||||
break;
|
||||
case self::BET_MODE:
|
||||
{
|
||||
$isOpen = myself()->_switchIsOpen('bountyMode');
|
||||
}
|
||||
break;
|
||||
case self::TREASURE_BOX_MODE:
|
||||
{
|
||||
$isOpen = myself()->_switchIsOpen('bigEventMode');
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $isOpen;
|
||||
}
|
||||
|
||||
protected static function getMetaList()
|
||||
{
|
||||
if (!self::$metaList) {
|
||||
|
@ -262,7 +262,7 @@ class RoomBattleDataService extends BaseService {
|
||||
$chestLootProbArr = explode(";",$rewardMeta['chestLootProb']);
|
||||
$rate = isset($chestLootProbArr[$teamRank-1]) ? $chestLootProbArr[$teamRank-1] : 0;
|
||||
//error_log(json_encode($member));
|
||||
if ($rate > 0 && !empty($member['box_num'])){
|
||||
if ($rate > 0 && !empty($member['box_num']) && myself()->_switchIsOpen('bigEventBoxDrop')){
|
||||
$rewardBox = array();
|
||||
for ($i = 0; $i < $member['box_num']; ++$i) {
|
||||
$rand = $rate * 100;
|
||||
|
@ -51,6 +51,10 @@ class ServerSwitchService {
|
||||
die();
|
||||
}
|
||||
|
||||
public static function switchIsOpen($name) {
|
||||
return self::getConfig()[$name] > 0;
|
||||
}
|
||||
|
||||
// private $switchConfig = null;
|
||||
//
|
||||
// private function initConfig(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user