fix: 修复审查发现的 4 个高优先级问题
- plan: getTodayTarget 补 customPlans 参数,timer/index 调用点传值,修复自定义计划每日目标失效 - leaderboard: fetchRank 加请求序列号丢弃过期响应,修复快速切换周期竞态 - leaderboard 云函数:遍历记录加防御(r.date/duration/数组校验),避免单条脏数据崩溃全榜 - tts: _upload cloudPath 补 volume/speed,避免不同音量语速音频互相覆盖 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -54,14 +54,19 @@ Page({
|
||||
},
|
||||
|
||||
fetchRank(cb) {
|
||||
// 序列号:快速切换周期时丢弃旧响应,避免旧 period 的数据覆盖新 period
|
||||
this._fetchSeq = (this._fetchSeq || 0) + 1
|
||||
const seq = this._fetchSeq
|
||||
const period = this.data.activePeriod
|
||||
this.setData({ loading: true, empty: false })
|
||||
wx.cloud.callFunction({
|
||||
name: 'leaderboard',
|
||||
data: {
|
||||
period: this.data.activePeriod,
|
||||
period,
|
||||
maxRank: config.leaderboardMaxRank
|
||||
}
|
||||
}).then(res => {
|
||||
if (seq !== this._fetchSeq) { if (cb) cb(); return } // 过期响应,丢弃
|
||||
this._applyResult(res.result || {})
|
||||
if (cb) cb()
|
||||
}).catch((err) => {
|
||||
@@ -70,6 +75,7 @@ Page({
|
||||
// normal (user didn't train today), and a toast would mislead
|
||||
// them into thinking the cloud is broken.
|
||||
console.warn('[leaderboard] cloud function failed, using local fallback:', err)
|
||||
if (seq !== this._fetchSeq) { if (cb) cb(); return }
|
||||
this._applyLocal()
|
||||
if (cb) cb()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user