新增模块抽象服务
This commit is contained in:
parent
2c18af0aa7
commit
9125292aa8
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user