feat: 实现Vue驱动的云存储系统初始功能
- 后端: Node.js + Express + SQLite架构 - 前端: Vue 3 + Axios实现 - 功能: 用户认证、文件上传/下载、分享链接、密码重置 - 安全: 密码加密、分享链接过期机制、缓存一致性 - 部署: Docker + Nginx容器化配置 - 测试: 完整的边界测试、并发测试和状态一致性测试
This commit is contained in:
34
backend/fix_expires_at_format.js
Normal file
34
backend/fix_expires_at_format.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const { db } = require('./database');
|
||||
|
||||
console.log('开始修复 expires_at 格式...\n');
|
||||
|
||||
// 查找所有有过期时间的分享
|
||||
const shares = db.prepare(`
|
||||
SELECT id, share_code, expires_at
|
||||
FROM shares
|
||||
WHERE expires_at IS NOT NULL
|
||||
`).all();
|
||||
|
||||
console.log(`找到 ${shares.length} 条需要修复的记录\n`);
|
||||
|
||||
let fixed = 0;
|
||||
const updateStmt = db.prepare('UPDATE shares SET expires_at = ? WHERE id = ?');
|
||||
|
||||
shares.forEach(share => {
|
||||
const oldFormat = share.expires_at;
|
||||
|
||||
// 如果是ISO格式(包含T和Z),需要转换
|
||||
if (oldFormat.includes('T') || oldFormat.includes('Z')) {
|
||||
// 转换为 SQLite datetime 格式: YYYY-MM-DD HH:MM:SS
|
||||
const newFormat = oldFormat.replace('T', ' ').replace(/\.\d+Z$/, '');
|
||||
|
||||
updateStmt.run(newFormat, share.id);
|
||||
fixed++;
|
||||
|
||||
console.log(`✓ 修复分享 ${share.share_code}:`);
|
||||
console.log(` 旧格式: ${oldFormat}`);
|
||||
console.log(` 新格式: ${newFormat}\n`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`\n修复完成! 共修复 ${fixed} 条记录`);
|
||||
Reference in New Issue
Block a user