fix: improve reservation cleanup and share popup handling

This commit is contained in:
2026-02-17 23:55:31 +08:00
parent 1a1c64c0e7
commit 8956270a60
3 changed files with 34 additions and 11 deletions

View File

@@ -2284,8 +2284,12 @@ const DownloadTrafficReservationDB = {
};
},
cleanupFinalizedHistory(keepDays = 7) {
const days = Math.min(365, Math.max(1, Math.floor(Number(keepDays) || 7)));
cleanupFinalizedHistory(keepDays = 0) {
// keepDays=0 表示立即清理全部已完成历史confirmed/expired/cancelled
const normalized = Number(keepDays);
const days = Number.isFinite(normalized)
? Math.min(365, Math.max(0, Math.floor(normalized)))
: 0;
return db.prepare(`
DELETE FROM user_download_traffic_reservations
WHERE status IN ('confirmed', 'expired', 'cancelled')