fix: 移除榜单失败toast,避免无数据时误导用户以为云端故障

日榜无数据是正常业务场景(用户当天未训练),弹toast会
让用户误解为系统故障。本地fallback已提供足够的降级体验。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-24 12:30:51 +08:00
parent 46738dd7cd
commit 9578273906
+3 -6
View File
@@ -66,14 +66,11 @@ Page({
if (cb) cb()
}).catch((err) => {
// Cloud function not deployed or network error — fall back to
// local data. Only show a toast if we have nothing to display
// yet (avoid confusing toast when a retry already has data).
// local data silently. No toast here: empty day-leaderboard is
// 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)
const hadData = this.data.rankedList && this.data.rankedList.length > 0
this._applyLocal()
if (!hadData && (!this.data.rankedList || this.data.rankedList.length === 0)) {
wx.showToast({ title: '云端榜单暂不可用', icon: 'none', duration: 2000 })
}
if (cb) cb()
})
},