From 47a7ae227cb743bb337c3ad4e9b5d88febcdb0a4 Mon Sep 17 00:00:00 2001 From: qtaxm <17772864223@163.com> Date: Wed, 8 Apr 2026 11:48:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20v4.3=20=E5=89=8D20=E7=A7=92=E5=85=A8?= =?UTF-8?q?=E9=80=9F=E4=B8=8D=E9=99=8D=E9=80=9F,=20=E4=B8=8A=E9=99=90?= =?UTF-8?q?=E6=94=B92000=E6=AC=A1,=20=E8=B6=8520=E7=A7=92=E8=BF=9E?= =?UTF-8?q?=E7=BB=AD=E5=94=AE=E7=BD=84=E6=89=8D=E9=99=8D=E9=80=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- glm-rush-v4.user.js | 29 +++++++++++++++++++++++++---- inject.js | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/glm-rush-v4.user.js b/glm-rush-v4.user.js index 49e15f8..b98ab80 100644 --- a/glm-rush-v4.user.js +++ b/glm-rush-v4.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 智谱 GLM Coding 抢购助手 v4.0 // @namespace http://tampermonkey.net/ -// @version 4.1 +// @version 4.3 // @description 并发重试 + 自适应间隔 + 反检测 + check校验 + 弹窗恢复 + 定时触发 + 配置持久化 // @author Assistant // @match *://www.bigmodel.cn/* @@ -18,7 +18,7 @@ // ═══════════════════════════════════════════ const DEFAULT_CFG = { concurrency: 3, // 并发路数 - maxRetry: 500, // 最大重试次数 + maxRetry: 2000, // 最大重试次数 burstCount: 10, // 前N次零延迟爆发 fastDelay: 50, // 爆发后的快速间隔 slowDelay: 150, // 后期随机间隔中值 @@ -202,6 +202,7 @@ let totalAttempt = 0; let consecutiveErrors = 0; let throttleCount = 0; + let consecutiveSoldOut = 0; while (totalAttempt < CFG.maxRetry && !stopRequested) { const batchSize = Math.min(CFG.concurrency, CFG.maxRetry - totalAttempt); @@ -286,9 +287,29 @@ // EXPIRE → 立即重试不等待 if (reasons.every(r => r === 'EXPIRE')) continue; + // 前20秒全速冲,之后才考虑降速 + const elapsedSec = (performance.now() - state.stats.startTime) / 1000; + + if (elapsedSec > 20) { + // 超过20秒 — 检测是否该降速 + const soldOutCount = reasons.filter(r => r === '售罄').length; + if (soldOutCount === batchSize) { + consecutiveSoldOut++; + } else { + consecutiveSoldOut = 0; + } + // 连续10轮全售罄 → 可能已经抢完了 + if (consecutiveSoldOut >= 10) { + if (consecutiveSoldOut === 10) log('连续售罄, 可能已抢完, 降速 (2s)...'); + await sleep(2000); + continue; + } + } + // 日志 (前5次 + 每20次) if (totalAttempt <= 5 * CFG.concurrency || totalAttempt % (20 * CFG.concurrency) === 0) { - log(`#${totalAttempt} ${reasons[0]}`); + const sec = elapsedSec.toFixed(0); + log(`#${totalAttempt} ${reasons[0]} (${sec}s)`); } // 自适应延迟 @@ -706,7 +727,7 @@ .keys{font-size:10px;color:#636e72;text-align:center;margin-top:6px}