diff --git a/src/services/watchProgress.js b/src/services/watchProgress.js index 0e7cf0a..3d5e2aa 100644 --- a/src/services/watchProgress.js +++ b/src/services/watchProgress.js @@ -5,8 +5,9 @@ const REPORT_INTERVAL_MS = 10000; const lastReportedAt = new Map(); export function reportWatchProgress(episodeId, positionSeconds, durationSeconds, source = 'web', force = false) { - const id = Number(episodeId); - if (!Number.isFinite(id) || id <= 0) return; + // 剧集 ID 为 19 位长整型,超出 JS 安全整数范围,必须保持字符串,禁止 Number 转换 + const id = String(episodeId ?? ''); + if (!/^\d+$/.test(id)) return; const now = Date.now(); if (!force && now - (lastReportedAt.get(id) || 0) < REPORT_INTERVAL_MS) return; lastReportedAt.set(id, now);