1.修复矿建鉴权报错
2.优化登录跳转接口 3.优化登录跳转接口 4.修复CURD生成代码模块表不加前缀访问返回404问题 5.系统级报错***优化报错Fatal error: Type of app\common\library\token\TokenExpirationException::$message
This commit is contained in:
@@ -245,6 +245,34 @@ Route::get('/admin/security/dataRecycleLog/index', [\app\admin\controller\securi
|
||||
Route::post('/admin/security/dataRecycleLog/restore', [\app\admin\controller\security\DataRecycleLog::class, 'restore']);
|
||||
Route::get('/admin/security/dataRecycleLog/info', [\app\admin\controller\security\DataRecycleLog::class, 'info']);
|
||||
|
||||
// ==================== CRUD 生成的根级控制器(/admin/item/index 或 /admin/Item/index,无子目录、无点号) ====================
|
||||
// 显式路由在上,此处作为兜底;与 /admin/module.controller/action 互补
|
||||
Route::add(
|
||||
['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'],
|
||||
'/admin/{controller:[a-zA-Z][a-zA-Z0-9]*}/{action}',
|
||||
function (\Webman\Http\Request $request, string $controller, string $action) {
|
||||
$class = '\\app\\admin\\controller\\' . ucfirst(strtolower($controller));
|
||||
if (!class_exists($class)) {
|
||||
return new Response(404, ['Content-Type' => 'application/json'], json_encode(['code' => 404, 'msg' => '404 Not Found', 'data' => []], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
if (!method_exists($class, $action)) {
|
||||
return new Response(404, ['Content-Type' => 'application/json'], json_encode(['code' => 404, 'msg' => '404 Not Found', 'data' => []], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
$request->controller = $class;
|
||||
try {
|
||||
$instance = new $class();
|
||||
return $instance->$action($request);
|
||||
} catch (\Throwable $e) {
|
||||
return new Response(500, ['Content-Type' => 'application/json'], json_encode([
|
||||
'code' => 0,
|
||||
'msg' => $e->getMessage(),
|
||||
'time' => time(),
|
||||
'data' => null,
|
||||
], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// ==================== 兼容 ThinkPHP 风格 URL(module.Controller/action) ====================
|
||||
// 前端使用 /admin/user.Rule/index 格式,需转换为控制器调用
|
||||
Route::add(
|
||||
|
||||
Reference in New Issue
Block a user