diff --git a/biji-php/config/routes.php b/biji-php/config/routes.php index b5c5b51..1523b73 100644 --- a/biji-php/config/routes.php +++ b/biji-php/config/routes.php @@ -42,12 +42,13 @@ $app->group('/api/user', function (RouteCollectorProxy $group) { })->add(new AuthMiddleware()); // Markdown 相关路由(无需认证 - 公开阅读) +// 注意:静态路由必须在动态路由之前定义,避免路由冲突 $app->group('/api/markdown', function (RouteCollectorProxy $group) { - $group->get('/{id}', [MarkdownController::class, 'getById']); $group->get('', [MarkdownController::class, 'getAll']); $group->get('/search', [MarkdownController::class, 'search']); - $group->get('/grouping/{groupingId}', [MarkdownController::class, 'getByGroupingId']); $group->get('/recent', [MarkdownController::class, 'getRecent']); + $group->get('/grouping/{groupingId}', [MarkdownController::class, 'getByGroupingId']); + $group->get('/{id}', [MarkdownController::class, 'getById']); }); // Markdown 相关路由(需要认证) @@ -75,11 +76,12 @@ $app->group('/api/images', function (RouteCollectorProxy $group) { }); // 图片相关路由(需要认证) +// 注意:静态路由必须在动态路由之前定义,避免路由冲突 $app->group('/api/images', function (RouteCollectorProxy $group) { $group->post('', [ImageController::class, 'upload']); - $group->post('/{id}', [ImageController::class, 'delete']); $group->post('/deleteByUrl', [ImageController::class, 'deleteByUrl']); $group->post('/batch', [ImageController::class, 'batchDelete']); + $group->post('/{id}', [ImageController::class, 'delete']); })->add(new AuthMiddleware()); // 系统设置相关路由(无需认证 - 公开查询注册状态) diff --git a/biji-qianduan/.env.development b/biji-qianduan/.env.development index 9212022..9b9b1ea 100644 --- a/biji-qianduan/.env.development +++ b/biji-qianduan/.env.development @@ -1 +1 @@ -VITE_API_BASE_URL=https://hdy16-16.311169.xyz/api +VITE_API_BASE_URL=http://localhost:80