fix: rotate once per errored phone number

This commit is contained in:
chick
2026-05-31 16:41:45 +08:00
parent f4288bc939
commit 6424862cc9
2 changed files with 11 additions and 16 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ SMSBower Phone Fill Tool
本版已集成 FlowPilot 同款自动切号机制: 本版已集成 FlowPilot 同款自动切号机制:
- 悬浮窗打开后默认开启“自动切号:开”。 - 悬浮窗打开后默认开启“自动切号:开”。
- 页面提示“该电话/手机号已被使用、已绑定、已注册”时,插件会自动识别并切换下一个号码;旧号按被拒原因释放,新号自动填入并复制。 - 页面提示“该电话/手机号已被使用、已绑定、已注册”时,只要确认是当前新号码触发的错误,插件会自动切换下一个号码;旧号按被拒原因释放,新号自动填入并复制。
- 页面提示“无法向此电话号码发送验证码”等发送失败时,插件会自动按可恢复失败换号。 - 页面提示“无法向此电话号码发送验证码”等发送失败时,插件会自动按可恢复失败换号。
- “检测报错换号”和“已使用换号”仍保留为手动兜底按钮。 - “检测报错换号”和“已使用换号”仍保留为手动兜底按钮。
- 仍然只负责填号/查码/复制,不自动点击目标页面继续按钮。 - 仍然只负责填号/查码/复制,不自动点击目标页面继续按钮。
+10 -15
View File
@@ -33,10 +33,8 @@
let autoRotateTimer = null; let autoRotateTimer = null;
let autoRotateInFlight = false; let autoRotateInFlight = false;
let autoRotateEnabled = true; let autoRotateEnabled = true;
let lastAutoRotateSignature = ''; let lastErroredPhoneNumber = '';
let lastAutoRotateAt = 0;
const AUTO_ROTATE_DEBOUNCE_MS = 800; const AUTO_ROTATE_DEBOUNCE_MS = 800;
const AUTO_ROTATE_COOLDOWN_MS = 8000;
function stopCodePolling() { function stopCodePolling() {
codePollToken += 1; codePollToken += 1;
@@ -170,6 +168,7 @@
await copyText(phone); await copyText(phone);
fillPhone(phone); fillPhone(phone);
$('.sb-current-phone').textContent = phone; $('.sb-current-phone').textContent = phone;
lastErroredPhoneNumber = '';
$('.sb-current-id').textContent = res.activation.activationId; $('.sb-current-id').textContent = res.activation.activationId;
const codeNode = $('.sb-current-code'); const codeNode = $('.sb-current-code');
if (codeNode) codeNode.textContent = '无'; if (codeNode) codeNode.textContent = '无';
@@ -195,25 +194,21 @@
btn.classList.toggle('sb-auto-on', autoRotateEnabled); btn.classList.toggle('sb-auto-on', autoRotateEnabled);
} }
function buildAutoRotateSignature(reason, text) { function getCurrentPhoneNumber() {
const compact = String(text || '').replace(/\s+/g, ' ').trim(); const phone = $('.sb-current-phone')?.textContent || latestSettings?.activeActivation?.phoneNumber || '';
return `${reason}:${compact.slice(-220)}`; return String(phone).trim();
} }
async function rotateFromClassifiedError(classified, source = 'manual') { async function rotateFromClassifiedError(classified, source = 'manual') {
const text = getPageTextForPhoneError(); const currentPhone = getCurrentPhoneNumber();
const signature = buildAutoRotateSignature(classified.reason, text);
const now = Date.now();
if (autoRotateInFlight) return false; if (autoRotateInFlight) return false;
if (source === 'auto' && signature === lastAutoRotateSignature && now - lastAutoRotateAt < AUTO_ROTATE_COOLDOWN_MS) { if (source === 'auto' && (!currentPhone || currentPhone === '无')) return false;
return false; if (source === 'auto' && currentPhone === lastErroredPhoneNumber) return false;
}
autoRotateInFlight = true; autoRotateInFlight = true;
lastAutoRotateSignature = signature;
lastAutoRotateAt = now;
try { try {
lastErroredPhoneNumber = currentPhone;
setStatus(source === 'auto' setStatus(source === 'auto'
? `检测到${classified.reason === 'phone_number_used' ? '号码已使用' : '验证码发送失败'},正在自动切号...` ? `当前号码 ${currentPhone} 触发${classified.reason === 'phone_number_used' ? '已使用' : '验证码发送失败'},正在自动切下一个号...`
: '检测到手机号错误,正在切号...'); : '检测到手机号错误,正在切号...');
await fetchAndFill({ reason: classified.reason, releaseAction: classified.releaseAction, skipSave: true }); await fetchAndFill({ reason: classified.reason, releaseAction: classified.releaseAction, skipSave: true });
return true; return true;