diff --git a/extend/catcher/ModuleService.php b/extend/catcher/ModuleService.php index ef90e0a..b6e6093 100644 --- a/extend/catcher/ModuleService.php +++ b/extend/catcher/ModuleService.php @@ -8,3 +8,34 @@ // +---------------------------------------------------------------------- // | Author: JaguarJack [ njphper@gmail.com ] // +---------------------------------------------------------------------- +namespace catcher; + +use think\Service; + +abstract class ModuleService extends Service +{ + abstract public function loadRouteFrom(); + + public function register() + { + $this->app->make('routePath')->loadRouterFrom($this->loadRouteFrom()); + + $this->registerEvents(); + } + + /** + * 时间注册 + * + * @time 2020年06月24日 + * @return void + */ + protected function registerEvents() + { + if (method_exists($this, 'loadEvents')) { + $this->app->event->listenEvents($this->loadEvents()); + } + } + + + +} \ No newline at end of file