From 5ec24ae9c9535a41934586677f092aebf277a57d Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Sat, 26 Sep 2020 15:11:50 +0800 Subject: [PATCH] =?UTF-8?q?update:=E6=A8=A1=E5=9D=97=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/monitor/MonitorService.php | 11 ++--------- extend/catcher/ModuleService.php | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 10 deletions(-) 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 *