fix(staff): on-demand modal 拉取仅在日期窗未变时回写缓存

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-07 18:58:30 +08:00
parent f51623d652
commit 5fd9878c38
+7 -5
View File
@@ -371,13 +371,15 @@ function openWechatCommModal(row: Account, metric: ChatMetric): void {
// 复用已缓存的 stats;点击早于列表加载完成则按需补拉。 // 复用已缓存的 stats;点击早于列表加载完成则按需补拉。
let stats = staffStats.value[row.account_id] let stats = staffStats.value[row.account_id]
if (!stats) { if (!stats) {
const start = statsStart.value
const end = statsEnd.value
try { try {
stats = await getStaffChatStats({ stats = await getStaffChatStats({ owner_account_id: row.account_id, start, end })
owner_account_id: row.account_id, // 仅当日期窗未变时回写缓存:避免旧窗 on-demand 结果覆盖日期切换后的新数据
start: statsStart.value, // (loadWechatStats 的 token 守卫负责批量重查)。
end: statsEnd.value, if (statsStart.value === start && statsEnd.value === end) {
})
staffStats.value[row.account_id] = stats staffStats.value[row.account_id] = stats
}
} catch { } catch {
return { items: [], total: 0, page, page_size } return { items: [], total: 0, page, page_size }
} }