From eb5f1a6e077fb012b794dd8c366fb7eacad1fe43 Mon Sep 17 00:00:00 2001 From: XXhaos Date: Sat, 18 Apr 2026 11:53:04 +0800 Subject: [PATCH] Update capture_gamertag.js --- Scripts/capture_gamertag.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Scripts/capture_gamertag.js b/Scripts/capture_gamertag.js index 2cd4f4a..ddb9035 100644 --- a/Scripts/capture_gamertag.js +++ b/Scripts/capture_gamertag.js @@ -101,6 +101,13 @@ function appendHistory(entry) { if (Array.isArray(parsed)) history = parsed; } catch (e) { history = []; } } + + // 去重:相同 cartId 的记录不重复写入 + if (history.some(h => h.cartId === entry.cartId)) { + console.log(`[history] SKIP: cartId=${entry.cartId} 已存在于历史中`); + return; + } + history.push(entry); if (history.length > MAX_HISTORY) history = history.slice(-MAX_HISTORY); $persistentStore.write(JSON.stringify(history), "cartId_history");