fix: 缓存击穿/play竞态/onUnload泄漏/清除数据UI/统计NaN

- leaderboard 云函数: _fetchLatestByOpenid 加 in-flight promise,并发请求复用同一次扫描,防缓存击穿
- voice: play 加序列号,丢弃过期播放,避免旧语音截断新语音
- timer: onUnload 补取消 _completionCountUp,系统返回手势不再泄漏动画定时器
- settings: 清除数据 setData 补 voiceGender/vibrateIntensity 重置,避免 UI 与存储不一致
- storage: getTotalStats 对 r.duration 防御(Number||0),避免脏数据产生 NaN 传染

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
liucheng
2026-07-25 15:01:51 +08:00
parent 41aa81083f
commit 983ae1b9cb
5 changed files with 19 additions and 2 deletions
+3 -2
View File
@@ -156,9 +156,10 @@ const getTotalStats = () => {
let maxDuration = 0
Object.keys(records).forEach((key) => {
records[key].forEach((r) => {
totalDuration += r.duration
const d = Number(r && r.duration) || 0
totalDuration += d
totalSessions++
if (r.duration > maxDuration) maxDuration = r.duration
if (d > maxDuration) maxDuration = d
})
})
return { totalDuration, totalSessions, maxDuration }