diff --git a/webapp/controller/OtherController.class.php b/webapp/controller/OtherController.class.php index 2866eac1..7911f3f6 100644 --- a/webapp/controller/OtherController.class.php +++ b/webapp/controller/OtherController.class.php @@ -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'] )); } diff --git a/webapp/services/ServerSwitch.php b/webapp/services/ServerSwitch.php index 478e8ff9..7c176473 100644 --- a/webapp/services/ServerSwitch.php +++ b/webapp/services/ServerSwitch.php @@ -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;