fix: snapshot LuckMail mails before polling code

This commit is contained in:
Q3CC
2026-04-24 23:45:47 +08:00
parent f3e8d051ea
commit 0676670b4b
2 changed files with 156 additions and 0 deletions
+10
View File
@@ -3113,6 +3113,16 @@ async function pollLuckmailVerificationCode(step, state, pollPayload = {}) {
excludeCodes: pollPayload.excludeCodes || [],
};
const initialCursor = normalizeLuckmailMailCursor((await getState()).currentLuckmailMailCursor);
if (!initialCursor.messageId && !initialCursor.receivedAt) {
const mailList = await client.user.getTokenMails(purchase.token);
const baselineCursor = buildLuckmailBaselineCursor(mailList?.mails || []);
await setLuckmailMailCursorState(baselineCursor);
if (baselineCursor?.messageId || baselineCursor?.receivedAt) {
await addLog(`步骤 ${step}:LuckMail 已保存当前邮箱旧邮件快照,后续仅使用新收到的验证码。`, 'info');
}
}
let lastError = null;
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
throwIfStopped();