From 896db8037aa3fd366873da919623db2bd7879d07 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 29 Aug 2024 17:02:50 +0800 Subject: [PATCH] 1 --- doc/OutAppTools.py | 19 +++++++++++++++++++ .../OutAppToolsController.class.php | 16 ++++++++++++++++ webapp/services/ServerSwitchService.php | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 doc/OutAppTools.py create mode 100644 webapp/controller/OutAppToolsController.class.php diff --git a/doc/OutAppTools.py b/doc/OutAppTools.py new file mode 100644 index 00000000..7b5ca6cc --- /dev/null +++ b/doc/OutAppTools.py @@ -0,0 +1,19 @@ +import _common + +class OutAppTools(object): + + def __init__(self): + self.apis = [ + { + 'name': 'refreshServerSwitch', + 'desc': '刷新服务器开关配置', + 'group': 'OutAppTools', + 'url': 'webapp/index.php?c=OutAppTools&a=refreshServerSwitch', + 'params': [ + ], + 'response': [ + _common.RspHead(), + ] + }, + + ] \ No newline at end of file diff --git a/webapp/controller/OutAppToolsController.class.php b/webapp/controller/OutAppToolsController.class.php new file mode 100644 index 00000000..4def3b49 --- /dev/null +++ b/webapp/controller/OutAppToolsController.class.php @@ -0,0 +1,16 @@ +_getRedis(ServerSwitchService::SERVER_SWITCH_KEY); + $data = ServerSwitchService::selectSwitchTable(); + $redis->set(ServerSwitchService::SERVER_SWITCH_KEY,json_encode($data)); + $redis->pexpire(ServerSwitchService::SERVER_SWITCH_KEY , 10*1000); + $this->_rspOk(); + } + +} diff --git a/webapp/services/ServerSwitchService.php b/webapp/services/ServerSwitchService.php index 504307ed..c47a9672 100644 --- a/webapp/services/ServerSwitchService.php +++ b/webapp/services/ServerSwitchService.php @@ -73,7 +73,7 @@ class ServerSwitchService { return $data; } - private static function selectSwitchTable(){ + public static function selectSwitchTable(){ $rows = SqlHelper::ormSelect(myself()->_getConfDbMysql(), 't_game_switch', array()); $data = array( 'normal' => array(),