备份:修复前完整项目快照 2026-04-19

This commit is contained in:
root
2026-04-19 19:15:01 +08:00
parent 5266d7732b
commit d00f41a120
449 changed files with 89577 additions and 23251 deletions
+32
View File
@@ -0,0 +1,32 @@
const fs = require('fs');
const content = fs.readFileSync('routes/auth.js', 'utf8');
// 修复路由路径:移除/api/auth前缀,因为主文件中已经使用了app.use('/api/auth', authRoutes)
const fixedContent = content
.replace(/router\.post\('\/api\/auth\/login'/g, "router.post('/login'")
.replace(/router\.get\('\/api\/auth\/verify'/g, "router.get('/verify'")
.replace(/router\.post\('\/api\/auth\/logout'/g, "router.post('/logout'");
// 写入修复后的文件
fs.writeFileSync('routes/auth.js', fixedContent);
console.log('✅ 已修复auth路由路径');
// 验证修复
const fixedFileContent = fs.readFileSync('routes/auth.js', 'utf8');
if (fixedFileContent.includes("router.post('/login'") &&
fixedFileContent.includes("router.get('/verify'") &&
fixedFileContent.includes("router.post('/logout'")) {
console.log('✅ 路径修复验证成功');
// 显示修复后的相关行
const lines = fixedFileContent.split('\n');
console.log('\n修复后的路由定义:');
for (let i = 0; i < lines.length; i++) {
if (lines[i].includes("router.")) {
console.log(`${i + 1}: ${lines[i]}`);
}
}
} else {
console.log('❌ 路径修复验证失败');
process.exit(1);
}