From 9125292aa8e978f06db827c95d93cb83032697b4 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 24 Jun 2020 09:11:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A8=A1=E5=9D=97=E6=8A=BD?= =?UTF-8?q?=E8=B1=A1=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/ModuleService.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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