From 6fcb3e1879a0be20aa629e33cb7dcbd551f1b80e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 19 Aug 2024 16:27:23 +0800 Subject: [PATCH] 1 --- webapp/controller/BaseController.class.php | 4 ++++ webapp/services/ServerSwitchService.php | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/webapp/controller/BaseController.class.php b/webapp/controller/BaseController.class.php index 82d77e8c..ddb4d0c0 100644 --- a/webapp/controller/BaseController.class.php +++ b/webapp/controller/BaseController.class.php @@ -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){ diff --git a/webapp/services/ServerSwitchService.php b/webapp/services/ServerSwitchService.php index 812f6a3e..74a65b4c 100644 --- a/webapp/services/ServerSwitchService.php +++ b/webapp/services/ServerSwitchService.php @@ -41,6 +41,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(){