diff --git a/catch/monitor/MonitorService.php b/catch/monitor/MonitorService.php index 1ce62d5..eed8ead 100644 --- a/catch/monitor/MonitorService.php +++ b/catch/monitor/MonitorService.php @@ -15,18 +15,11 @@ use catcher\ModuleService; class MonitorService extends ModuleService { - public function register() + protected function loadConfig() { - parent::register(); // TODO: Change the autogenerated stub - - $this->registerConfig(); + return require __DIR__ . DIRECTORY_SEPARATOR . 'config.php'; } - protected function registerConfig() - { - $this->app->config->set(array_merge($this->app->config->get('catch'), - require __DIR__ . DIRECTORY_SEPARATOR . 'config.php'), 'catch'); - } public function loadRouteFrom() { // TODO: Implement loadRouteFrom() method. diff --git a/extend/catcher/ModuleService.php b/extend/catcher/ModuleService.php index 286df81..d27c8c4 100644 --- a/extend/catcher/ModuleService.php +++ b/extend/catcher/ModuleService.php @@ -28,7 +28,9 @@ abstract class ModuleService extends Service $this->registerEvents(); - $this->registerCommands();; + $this->registerCommands(); + + $this->registerConfig(); } /** @@ -44,6 +46,19 @@ abstract class ModuleService extends Service } } + /** + * register config + * + * @time 2020年09月25日 + * @return void + */ + protected function registerConfig() + { + if (method_exists($this, 'loadConfig')) { + $this->app->config->set(array_merge($this->app->config->get('catch'), $this->loadConfig()), 'catch'); + } + } + /** * 注册commands *