diff --git a/src/common/Module.php b/src/common/Module.php index c2fcf2f..9fa5d1c 100644 --- a/src/common/Module.php +++ b/src/common/Module.php @@ -87,6 +87,10 @@ public static function isInstalled() $config = $connections[$type] ?? []; + if ($config['database'] == '' && $config['username'] == 'root' && $config['password'] == '') { + return false; + } + if ($config['database'] == 'test' && $config['username'] == 'username' && $config['password'] == 'password') { return false; } diff --git a/src/common/event/Log.php b/src/common/event/Log.php index 610a485..0dcfe5b 100644 --- a/src/common/event/Log.php +++ b/src/common/event/Log.php @@ -17,10 +17,6 @@ public function __construct(App $app) public function handle($data) { - if (!Module::isInstalled()) { - return true; - } - $controller = strtolower($this->app->request->controller()); $action = strtolower($this->app->request->action()); diff --git a/src/common/middleware/Auth.php b/src/common/middleware/Auth.php index ca460b2..9e43468 100644 --- a/src/common/middleware/Auth.php +++ b/src/common/middleware/Auth.php @@ -45,9 +45,11 @@ public function handle($request, Closure $next) return $response; } - ExtLoader::watch('tpext_menus', Menu::class, false, '接收菜单创建/删除事件'); - ExtLoader::watch('tpext_copy_assets', Assets::class, false, '监视资源刷新,修改版本号'); - ExtLoader::watch(HttpEnd::class, Log::class, false, '记录日志'); + if (Module::isInstalled()) { + ExtLoader::watch('tpext_menus', Menu::class, false, '接收菜单创建/删除事件'); + ExtLoader::watch('tpext_copy_assets', Assets::class, false, '监视资源刷新,修改版本号'); + ExtLoader::watch(HttpEnd::class, Log::class, false, '记录日志'); + } return $next($request); } @@ -85,7 +87,12 @@ protected function setup() config('dispatch_success_tmpl', $tplPath . 'dispatch_jump.tpl'); config('dispatch_error_tmpl', $tplPath . 'dispatch_jump.tpl'); - $config = $instance->getConfig(); + if (Module::isInstalled()) { + $config = $instance->getConfig(); + } else { + $config = $instance->defaultConfig(); + } + $admin_layout = $rootPath . implode(DIRECTORY_SEPARATOR, ['src', 'admin', 'view', 'layout.html']); if ($config['minify']) {