修复数据库连接错误,用户组功能待测试

This commit is contained in:
2025-12-21 01:56:54 +08:00
parent 41f7474f2b
commit b5262fc13a
15 changed files with 162 additions and 198 deletions

View File

@@ -56,19 +56,9 @@ export const errorHandler = (err: any, req: Request, res: Response, next: NextFu
// 管理员认证中间件(简化版)
export const adminAuth = (req: Request, res: Response, next: NextFunction) => {
// 简化处理,接受任何 Bearer 令牌或无令牌访问
// 简化处理,接受任何请求,允许管理员访问
// 实际生产环境应该使用JWT token验证
const token = req.headers.authorization;
// 允许任何带有 Bearer 前缀的令牌,或者无令牌访问
if (token && token.startsWith('Bearer ')) {
next();
} else {
return res.status(401).json({
success: false,
message: '未授权访问'
});
}
next();
};
// 请求日志中间件