This commit is contained in:
aozhiwei 2024-08-16 16:10:44 +08:00
parent 0b8c0874d4
commit 60278ced52
2 changed files with 17 additions and 5 deletions

View File

@ -366,10 +366,17 @@ class OtherController extends BaseAuthedController {
}
public function getServerSwitch(){
$version = getReqVal('_version', 0);
$packageId = getReqVal('_packageid', 0);
$row = SqlHelper::ormSelectOne(myself()->_getConfDbMysql(), 't_audit',
array(
'model' => $packageId
));
$examining = !empty($row) && $row['version'] == $version && $row['is_auditing'] ? 1 : 0;
$switchObj = new ServerSwitch();
$con = $switchObj->getConfig();
$con = $switchObj->getGameSwitch();
$this->_rspData(array(
'data'=>$con
'data' => $examining ? $con['auditing'] : $con['normal']
));
}

View File

@ -4,9 +4,10 @@ use phpcommon\SqlHelper;
class ServerSwitch {
const SERVER_SWITCH_KEY = 'server_switch_redis_key:';
const SERVER_AUDITING_KEY = 'server_auditing_redis_key:';
public function getConfig(){
return $this->getGameSwitch();
return $this->getGameSwitch()['normal'];
}
public function heroChainIsOpen(){
@ -60,10 +61,14 @@ class ServerSwitch {
private function selectSwitchTable(){
$rows = SqlHelper::ormSelect(myself()->_getConfDbMysql(), 't_game_switch', array());
$data = array();
$data = array(
'normal' => array(),
'auditing' => array(),
);
if (count($rows) > 0){
foreach ($rows as $row){
$data[$row['switch_name']] = $row['is_open'];
$data['normal'][$row['switch_name']] = $row['is_open'];
$data['auditing'][$row['switch_name']] = $row['audit_is_open'];
}
}
return $data;