This commit is contained in:
aozhiwei 2024-08-19 16:39:09 +08:00
commit aabfb95726
7 changed files with 29 additions and 41 deletions

View File

@ -406,6 +406,10 @@ class BaseController {
}
}
public static function _verifySwitch($name) {
myself()->_callServiceStatic('ServerSwitchService', 'verifySwitch', $name);
}
public function _mergeAlikeItemKey($items){
$hashItems = array();
foreach ($items as $item){

View File

@ -72,16 +72,10 @@ class BattleController extends BaseAuthedController {
return;
}
$data = json_decode(file_get_contents('php://input'), true);
/*error_log(json_encode(array(
'a' => 'battleReport',
'post_data' => $data
)));*/
$teamList = array();
if ($data) {
$teamList = $data['team_list'];
}
// error_log(json_encode($teamList));
$battleDataService = new services\BattleDataService();
$battleDataService->teamList = $teamList;
$battleDataService->updateBattleData();
@ -95,7 +89,6 @@ class BattleController extends BaseAuthedController {
'modifytime' => $this->_getNowTime(),
)
);
// error_log(json_encode($battleDataService->getReward()));
$data = array(
'reward' => $battleDataService->getReward()
);
@ -138,7 +131,6 @@ class BattleController extends BaseAuthedController {
return;
}
$data = json_decode(file_get_contents('php://input'), true);
error_log(json_encode($data));
foreach ($data['team_list'] as $teamData){
$this->_handleTeamReport($teamData);
}
@ -214,7 +206,6 @@ class BattleController extends BaseAuthedController {
return;
}
$data = json_decode(file_get_contents('php://input'), true);
error_log(json_encode($data));
$this->_handleTeamReport($data);
// $battle_uuid = getXVal($data,'battle_uuid', 0);
// $room_uuid = getXVal($data,'room_uuid', 0);
@ -285,9 +276,6 @@ class BattleController extends BaseAuthedController {
return;
}
$input = json_decode(file_get_contents('php://input'), true);
if (myself()->_getAccountId() == '6513_2006_U1JcRueKMQxN9BDw8p7pu61gfdzsS7G3') {
error_log(json_encode($input));
}
$roomBattleDataService = new services\RoomBattleDataService();
$roomBattleDataService->mapMode = getXVal($input,'map_mode', 0);
error_log('roomReportMode:'.getXVal($input,'map_mode', 0));
@ -361,7 +349,6 @@ class BattleController extends BaseAuthedController {
}
}
}
error_log(json_encode($realPlayerHash));
$accountIdPair = array();
foreach ($realPlayerHash as $accountId => $val) {
foreach ($realPlayerHashCopy as $accountIdCopy => $valCopy) {
@ -379,7 +366,6 @@ class BattleController extends BaseAuthedController {
}
}
}
error_log(json_encode($accountIdPair));
$nowTime = myself()->_getNowTime();
foreach ($accountIdPair as $pair) {
$accountId1 = $pair[0];
@ -422,7 +408,6 @@ class BattleController extends BaseAuthedController {
public function getBattleData()
{
error_log(json_encode($_REQUEST));
$data = array(
'members' => array()
);
@ -538,7 +523,6 @@ class BattleController extends BaseAuthedController {
$customData = array();
{
$rawData = file_get_contents('php://input');
error_log($rawData);
$sign = strstr($rawData, '|', true);
$customData = strstr($rawData, '|');
$customData = substr($customData, 1);
@ -553,7 +537,6 @@ class BattleController extends BaseAuthedController {
$customData = json_decode($customData, true);
}
error_log(json_encode($customData));
$zoneId = $customData['zone_id'];
$nodeId = $customData['node_id'];
$roomUuid = $customData['room_uuid'];
@ -687,7 +670,6 @@ class BattleController extends BaseAuthedController {
}
array_push($data['ob_list'], $info);
}
error_log(json_encode($data));
myself()->_rspData($data);
}
@ -702,7 +684,7 @@ class BattleController extends BaseAuthedController {
$customData = array();
{
$rawData = file_get_contents('php://input');
error_log($rawData);
$headStr = strstr($rawData, '|', true);
$sign = strstr($headStr, ':', true);
$customData = strstr($rawData, '|');
@ -719,7 +701,7 @@ class BattleController extends BaseAuthedController {
}
$currSeason = mt\RankSeason::getCurrentSeason();
error_log(json_encode($customData));
$zoneId = $customData['zone_id'];
$nodeId = $customData['node_id'];
$modeId = $customData['mode_id'];
@ -833,7 +815,6 @@ class BattleController extends BaseAuthedController {
}
array_push($data['team_list'], $teamInfo);
}
error_log(json_encode($data));
$this->decTicket($r, $customData, $mapModeMeta);
myself()->_rspData($data);
}
@ -844,7 +825,6 @@ class BattleController extends BaseAuthedController {
$customData = array();
{
$rawData = file_get_contents('php://input');
error_log($rawData);
$headStr = strstr($rawData, '|', true);
$sign = strstr($headStr, ':', true);
$customData = strstr($rawData, '|');
@ -937,7 +917,6 @@ class BattleController extends BaseAuthedController {
}
array_push($data['team_list'], $teamInfo);
}
error_log(json_encode($data));
myself()->_rspData($data);
}
@ -979,7 +958,6 @@ class BattleController extends BaseAuthedController {
public function getBattleDataNew()
{
error_log(json_encode($_REQUEST));
$members = json_decode(getReqVal('members', ''), true);
$data = array(
'members' => array()
@ -1197,7 +1175,6 @@ class BattleController extends BaseAuthedController {
public function requestAllocBoxNum()
{
error_log(json_encode($_REQUEST));
$roomUuid = getReqVal('room_uuid', '');
$row = SqlHelper::ormSelectOne(
$this->_getSelfMysql(),
@ -1254,7 +1231,6 @@ class BattleController extends BaseAuthedController {
public function requestReturnBoxNum()
{
error_log(json_encode($_REQUEST));
$roomUuid = getReqVal('room_uuid', '');
$usedNum = getReqVal('used_num', 0);
$allocBoxNum = getReqVal('alloc_box_num', 0);

View File

@ -138,7 +138,6 @@ class BattleDataController extends BaseAuthedController {
return;
}
$data = json_decode(file_get_contents('php://input'), true);
error_log(json_encode($data));
foreach ($data['team_list'] as $teamData){
$this->_handleTeamReport($teamData);
}
@ -212,7 +211,6 @@ class BattleDataController extends BaseAuthedController {
return;
}
$data = json_decode(file_get_contents('php://input'), true);
error_log(json_encode($data));
$this->_handleTeamReport($data);
// $battle_uuid = getXVal($data,'battle_uuid', 0);
// $room_uuid = getXVal($data,'room_uuid', 0);
@ -283,9 +281,6 @@ class BattleDataController extends BaseAuthedController {
return;
}
$input = json_decode(file_get_contents('php://input'), true);
if (myself()->_getAccountId() == '6513_2006_U1JcRueKMQxN9BDw8p7pu61gfdzsS7G3') {
error_log(json_encode($input));
}
$roomBattleDataService = new services\RoomBattleDataService();
$roomBattleDataService->mapMode = getXVal($input,'map_mode', 0);
error_log('roomReportMode:'.getXVal($input,'map_mode', 0));
@ -359,7 +354,6 @@ class BattleDataController extends BaseAuthedController {
}
}
}
error_log(json_encode($realPlayerHash));
$accountIdPair = array();
foreach ($realPlayerHash as $accountId => $val) {
foreach ($realPlayerHashCopy as $accountIdCopy => $valCopy) {
@ -377,7 +371,6 @@ class BattleDataController extends BaseAuthedController {
}
}
}
error_log(json_encode($accountIdPair));
$nowTime = myself()->_getNowTime();
foreach ($accountIdPair as $pair) {
$accountId1 = $pair[0];
@ -536,7 +529,7 @@ class BattleDataController extends BaseAuthedController {
$customData = array();
{
$rawData = file_get_contents('php://input');
error_log($rawData);
$sign = strstr($rawData, '|', true);
$customData = strstr($rawData, '|');
$customData = substr($customData, 1);
@ -551,7 +544,7 @@ class BattleDataController extends BaseAuthedController {
$customData = json_decode($customData, true);
}
error_log(json_encode($customData));
$zoneId = $customData['zone_id'];
$nodeId = $customData['node_id'];
$roomUuid = $customData['room_uuid'];
@ -685,7 +678,7 @@ class BattleDataController extends BaseAuthedController {
}
array_push($data['ob_list'], $info);
}
error_log(json_encode($data));
myself()->_rspData($data);
}
@ -700,7 +693,7 @@ class BattleDataController extends BaseAuthedController {
$customData = array();
{
$rawData = file_get_contents('php://input');
error_log($rawData);
$headStr = strstr($rawData, '|', true);
$sign = strstr($headStr, ':', true);
$customData = strstr($rawData, '|');
@ -717,7 +710,7 @@ class BattleDataController extends BaseAuthedController {
}
$currSeason = mt\RankSeason::getCurrentSeason();
error_log(json_encode($customData));
$zoneId = $customData['zone_id'];
$nodeId = $customData['node_id'];
$modeId = $customData['mode_id'];
@ -831,7 +824,7 @@ class BattleDataController extends BaseAuthedController {
}
array_push($data['team_list'], $teamInfo);
}
error_log(json_encode($data));
$this->decTicket($r, $customData, $mapModeMeta);
myself()->_rspData($data);
}
@ -842,7 +835,7 @@ class BattleDataController extends BaseAuthedController {
$customData = array();
{
$rawData = file_get_contents('php://input');
error_log($rawData);
$headStr = strstr($rawData, '|', true);
$sign = strstr($headStr, ':', true);
$customData = strstr($rawData, '|');
@ -935,7 +928,7 @@ class BattleDataController extends BaseAuthedController {
}
array_push($data['team_list'], $teamInfo);
}
error_log(json_encode($data));
myself()->_rspData($data);
}

View File

@ -54,6 +54,7 @@ class BigwheelController extends BaseAuthedController {
public function drawS()
{
myself()->_verifySwitch('bigWheel');
$drawType = getReqVal('type', 0);
if (!($drawType == 0 || $drawType == 1 || $drawType == 2)) {
myself()->_rspErr(2, 'type param error');
@ -293,6 +294,7 @@ class BigwheelController extends BaseAuthedController {
public function buyS()
{
myself()->_verifySwitch('bigWheel');
$key = $this->getMidDataKey();
$data = $this->getAndCreateData($key);
$gridRef = null;

View File

@ -46,6 +46,7 @@ class BlockChainController extends BaseAuthedController {
public function active721Nft()
{
myself()->_verifySwitch('heroMint');
$type = getReqVal('type', 0);
$uniid = getReqVal('uniid', 0);
$accountAddress = strtolower(getReqVal('account_address', ''));
@ -109,6 +110,7 @@ class BlockChainController extends BaseAuthedController {
public function mintGoldBullion()
{
myself()->_verifySwitch('goldSyn');
$type = getReqVal('type', 0);
$accountAddress = strtolower(getReqVal('account_address', ''));
if ($accountAddress != myself()->_getAddress()) {

View File

@ -18,6 +18,7 @@ class OutAppMintController extends BaseController {
public function mintHero()
{
myself()->_verifySwitch('heroMint');
error_log(json_encode($_REQUEST));
$accountId = getReqVal('account_id', '');
//$accountAddress = User::findUserAddress($accountId);

View File

@ -1,5 +1,7 @@
<?php
namespace services;
use phpcommon\SqlHelper;
class ServerSwitchService {
@ -41,6 +43,14 @@ class ServerSwitchService {
return false;
}
public static function verifySwitch($name) {
if (self::getConfig()[$name] > 0){
return;
}
myself()->_rspErr(1008, 'function is disabled');
die();
}
// private $switchConfig = null;
//
// private function initConfig(){