优化下拉列表组件,修复若干BUG
This commit is contained in:
@@ -245,11 +245,11 @@ 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']);
|
||||
|
||||
// ==================== 兼容 ThinkPHP 风格 URL(module.Controller/action) ====================
|
||||
// 前端使用 /admin/user.Rule/index 格式,需转换为控制器调用
|
||||
// ==================== 兼容 ThinkPHP 风格 URL(module.Controller/action 或 module.sub.Controller/action) ====================
|
||||
// 前端使用 /admin/user.Rule/index、/admin/mall.pints.Order/index 等格式,需转换为控制器调用
|
||||
Route::add(
|
||||
['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'],
|
||||
'/admin/{controllerPart:[a-zA-Z]+\\.[a-zA-Z0-9]+}/{action}',
|
||||
'/admin/{controllerPart:[a-zA-Z0-9]+(?:\\.[a-zA-Z0-9]+)+}/{action}',
|
||||
function (\Webman\Http\Request $request, string $controllerPart, string $action) {
|
||||
$pos = strpos($controllerPart, '.');
|
||||
if ($pos === false) {
|
||||
@@ -257,7 +257,9 @@ Route::add(
|
||||
}
|
||||
$module = substr($controllerPart, 0, $pos);
|
||||
$controller = substr($controllerPart, $pos + 1);
|
||||
$class = '\\app\\admin\\controller\\' . strtolower($module) . '\\' . $controller;
|
||||
// 支持多级路径:pints.Order -> pints\Order,redemption.Order -> redemption\Order
|
||||
$controllerClass = str_replace('.', '\\', $controller);
|
||||
$class = '\\app\\admin\\controller\\' . strtolower($module) . '\\' . $controllerClass;
|
||||
if (!class_exists($class)) {
|
||||
return new Response(404, ['Content-Type' => 'application/json'], json_encode(['code' => 404, 'msg' => '404 Not Found', 'data' => []], JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user