pref: 增加服务类优化UI版面

This commit is contained in:
Ying
2023-06-19 14:32:30 +08:00
parent 27eda6f37f
commit 2b8f874450
148 changed files with 3933 additions and 9286 deletions

View File

@@ -14,16 +14,6 @@ use Webman\Route;
// 验证码路由
Route::any('/captcha', [app\BaseController::class, 'captcha']);
/**
* 加载自定义路由 [插件路由]
*/
$defineRoute = require __DIR__ . '/defineRoute.php';
if ($defineRoute && is_array($defineRoute)) {
foreach ($defineRoute as $key => $value) {
Route::any($key, $value);
}
}
/**
* 默认管理员路由
* @var string $manage
@@ -76,4 +66,30 @@ Route::fallback(function ($request) {
}
return response(request_error(current($parseApp)), 404);
});
});
// 执行插件初始化
$pluginList = get_plugin_list();
foreach ($pluginList as $item) {
if (!$item['status']) {
continue;
}
foreach ($item['rewrite'] as $route => $value) {
$separator = explode('/', $value);
$method = end($separator);
array_pop($separator);
$filePath = implode('\\', $separator);
$controller = 'app\\index\\controller\\' . $filePath;
if (class_exists($controller) && method_exists($controller, $method)) {
try {
$classFullName = (new ReflectionClass($controller))->getName();
Route::any($route, [$classFullName, $method]);
} catch (\Throwable $e) {
var_dump('error: ' . $e->getMessage());
}
} else {
var_dump("\033[31m$controller or $method does not exist!\033[0m");
}
}
}