diff --git a/backend/check_expire.sql b/backend/check_expire.sql new file mode 100644 index 0000000..b4359f8 --- /dev/null +++ b/backend/check_expire.sql @@ -0,0 +1,19 @@ +SELECT + share_code, + substr(share_path, 1, 30) as path, + created_at, + expires_at, + datetime('now') as current_time, + CASE + WHEN expires_at IS NULL THEN '永久有效' + WHEN expires_at > datetime('now') THEN '未过期' + ELSE '已过期' + END as status, + CASE + WHEN expires_at IS NOT NULL AND expires_at > datetime('now') THEN '通过' + WHEN expires_at IS NULL THEN '通过' + ELSE '拦截' + END as findByCode_result +FROM shares +ORDER BY created_at DESC +LIMIT 10; diff --git a/backend/test_expire.js b/backend/test_expire.js new file mode 100644 index 0000000..77176f2 --- /dev/null +++ b/backend/test_expire.js @@ -0,0 +1,27 @@ +const { ShareDB } = require('./database'); + +// 测试过期验证 +console.log('=== 测试分享过期验证 ===\n'); + +// 获取所有分享 +const { db } = require('./database'); +const allShares = db.prepare('SELECT share_code, created_at, expires_at, datetime("now") as current_time FROM shares LIMIT 5').all(); + +console.log('数据库中的分享:'); +allShares.forEach(share => { + console.log(`\n分享码: ${share.share_code}`); + console.log(`创建时间: ${share.created_at}`); + console.log(`到期时间: ${share.expires_at || '永久'}`); + console.log(`当前时间: ${share.current_time}`); + + if (share.expires_at) { + const isExpired = share.expires_at <= share.current_time; + console.log(`是否过期: ${isExpired ? '是' : '否'}`); + } + + // 测试findByCode + const found = ShareDB.findByCode(share.share_code); + console.log(`findByCode结果: ${found ? '找到' : '未找到(已过滤)'}`); +}); + +console.log('\n=== 测试完成 ==='); diff --git a/frontend/app.html b/frontend/app.html index b544d48..cb5cec3 100644 --- a/frontend/app.html +++ b/frontend/app.html @@ -785,7 +785,7 @@ - {{ file.name }} + {{ file.name }} {{ file.isDirectory ? '-' : file.sizeFormatted }} {{ formatDate(file.modifiedTime) }} @@ -1330,13 +1330,15 @@ {{ u.id }} - - {{ u.username }} - - - + +
+ {{ u.username }} + + + +
- {{ u.email }} + {{ u.email }} 仅本地 仅SFTP @@ -1604,7 +1606,7 @@ - {{ file.name }} + {{ file.name }} {{ file.isDirectory ? '-' : file.sizeFormatted }} {{ formatDate(file.modifiedAt) }}