修复 LuckMail 验证码轮询与重试逻辑

This commit is contained in:
zhangkun
2026-04-27 22:33:41 +08:00
parent 0f430113fa
commit 9b38b0bffe
4 changed files with 96 additions and 16 deletions
+7 -1
View File
@@ -917,7 +917,7 @@
getLegacyVerificationResendCountDefault(step, { requestFreshCodeFirst })
)
: getConfiguredVerificationResendCount(step, state, { requestFreshCodeFirst });
const maxSubmitAttempts = 15;
const maxSubmitAttempts = mail.provider === LUCKMAIL_PROVIDER ? 3 : 15;
const resendIntervalMs = Math.max(0, Number(options.resendIntervalMs) || 0);
let lastResendAt = Number(options.lastResendAt) || 0;
@@ -1002,6 +1002,12 @@
throw new Error(`步骤 ${step}:验证码连续失败,已达到 ${maxSubmitAttempts} 次重试上限。`);
}
if (mail.provider === LUCKMAIL_PROVIDER) {
await addLog(`步骤 ${step}:LuckMail 验证码提交失败,等待 15 秒后重新轮询 /code 接口(${attempt + 1}/${maxSubmitAttempts}...`, 'warn');
await sleepWithStop(15000);
continue;
}
const remainingBeforeResendMs = resendIntervalMs > 0 && lastResendAt > 0
? Math.max(0, resendIntervalMs - (Date.now() - lastResendAt))
: 0;