新增模块抽象服务

This commit is contained in:
JaguarJack 2020-06-24 09:11:30 +08:00
parent 2c18af0aa7
commit 9125292aa8

View File

@ -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());
}
}
}