RFC脚本页面可视化和随机刷新 其它类似后台系统的 VPS 商家也可使用

前几天的VPS抢购脚本RFC VPS 抢购神器:通用油猴脚本自动刷新 + 自动填6折码 + 一键下单(支持同类商家)

AI做了一下升级,现在可以在页面上可视化看到进度了,加了一下随机刷新,降低一下服务器的负载和抢购的速度;

详细的说明可以参考前文,这里放的优化后的脚本

图片[1]-RFC脚本页面可视化和随机刷新  其它类似后台系统的 VPS 商家也可使用-VPS SO

经验分享1,如果上次抢购已经在购物车页验证优惠码但是没抢到,下次就不需要验证了,直接提交快人一步。
经验分享2,如果浏览器插件过多可能会影响速度,推荐edge只加油猴插件或者chrome只加油猴插件。首推edge。
refreshMinMs: 2000, //最小时间,2S
refreshMaxMs: 4000, //最大时间,4S
可以自己调间隔。

// ==UserScript==
// @name         RFCShop 抢购通用版 (随机刷新 + 页面状态提示)
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  随机刷新 + 实时状态悬浮提示 + 精准优惠码校验
// @author       iniwex
// @match        *://my.rfchost.com/cart.php*
// @match        *://my.rfchost.com/index.php?rp=/store/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    /************ 配置 ************/
    const PROMO_CODE = "我是高手我不需要发工单";

    const SETTINGS = {
        refreshMinMs: 2000, //最小时间,2S
        refreshMaxMs: 4000, //最大时间,4S
        billingCycle: "monthly",
        playAlarm: true,
        autoSubmit: true
    };

    /************ 工具 ************/
    function getRandomRefreshMs() {
        return Math.floor(
            Math.random() * (SETTINGS.refreshMaxMs - SETTINGS.refreshMinMs + 1)
        ) + SETTINGS.refreshMinMs;
    }

    let isProcessingPromo = false;
    let nextRefreshAt = null;

    const audio = new Audio('https://actions.google.com/sounds/v1/alarms/beep_short.ogg');
    const url = location.href;
    const action = new URLSearchParams(location.search).get('a');

    /************ 悬浮状态面板 ************/
    const panel = document.createElement('div');
    panel.id = 'rfcshop-panel';
    panel.style.cssText = `
        position: fixed;
        right: 12px;
        bottom: 12px;
        z-index: 999999;
        background: rgba(0,0,0,0.75);
        color: #00ff99;
        padding: 10px 12px;
        font-size: 12px;
        line-height: 1.6;
        border-radius: 8px;
        font-family: Consolas, monospace;
        min-width: 200px;
        box-shadow: 0 0 10px rgba(0,255,153,.4);
    `;
    document.body.appendChild(panel);

    function updatePanel(text) {
        panel.innerHTML = `<b>RFCShop 抢购助手</b><br>${text}`;
    }

    /************ 倒计时显示 ************/
    setInterval(() => {
        if (nextRefreshAt) {
            const left = Math.max(0, nextRefreshAt - Date.now());
            updatePanel(panel.dataset.base + `<br>⏳ 刷新倒计时:${(left / 1000).toFixed(1)}s`);
        }
    }, 200);

    function scheduleRefresh(reason) {
        const t = getRandomRefreshMs();
        nextRefreshAt = Date.now() + t;
        panel.dataset.base = `
        📌 阶段:${reason}
        🔄 下次刷新:${(t / 1000).toFixed(1)}s
        `;
        setTimeout(() => location.reload(), t);
    }

    /************ 1. 商品列表页 ************/
    if (url.includes('index.php?rp=/store/')) {
        const orderBtn = document.querySelector('a[href*="a=add"]');
        if (orderBtn) {
            updatePanel('🟢 检测到库存<br>➡️ 正在进入配置页');
            orderBtn.click();
        } else {
            updatePanel('🔴 暂无库存<br>♻️ 随机刷新中');
            scheduleRefresh('商品列表页');
        }
        return;
    }

    /************ 2. 配置页 ************/
    if (action === 'confproduct' || url.includes('a=add')) {
        if (
            document.body.innerText.includes('Out of Stock') ||
            document.body.innerText.includes('缺货')
        ) {
            updatePanel('🔴 配置页缺货<br>♻️ 随机刷新');
            scheduleRefresh('配置页缺货');
            return;
        }

        updatePanel('🟢 已有库存<br>⚙️ 自动配置中');

        if (SETTINGS.playAlarm) audio.play();

        const cycleInput = document.querySelector(
            `input[name="billingcycle"][value="${SETTINGS.billingCycle}"]`
        );
        if (cycleInput && !cycleInput.checked) {
            if (window.jQuery && window.jQuery(cycleInput).iCheck) {
                window.jQuery(cycleInput).iCheck('check');
            } else {
                cycleInput.click();
            }
        }

        const configBtnTimer = setInterval(() => {
            const nextBtn =
                document.getElementById('btnCompleteProductConfigMob') ||
                document.querySelector('button[type="submit"].btn-checkout');

            if (nextBtn && !nextBtn.classList.contains('hidden')) {
                clearInterval(configBtnTimer);
                updatePanel('➡️ 配置完成<br>🛒 进入购物车');
                nextBtn.click();
            }
        }, 200);
    }

    /************ 3. 购物车预览页 ************/
    if (action === 'view') {
        updatePanel('🛒 购物车预览<br>➡️ 自动进入结账');
        const checkoutBtn = document.getElementById('checkout');
        if (checkoutBtn) checkoutBtn.click();
    }

    /************ 4. 结账页 ************/
    if (action === 'checkout') {
        updatePanel('💳 结账页<br>⌛ 等待条件满足');

        const finalRunner = setInterval(() => {
            const promoInput = document.getElementById('inputPromotionCode');
            const validateBtn = document.querySelector(
                "body > div.app-main > div.main-body > div > div.main-grid > div.main-content.main-content-m-w > div:nth-child(2) > div.section-body > div > form > div > div.search-group-btn > button"
            );
            const tokenInput = document.getElementById('turnstile_token');
            const checkoutBtn = document.getElementById('checkout');
            const realTOS = document.querySelector('input[data-tos-checkbox]');

            const promoApplied =
                document.body.innerText.includes('移除') ||
                document.body.innerText.includes('Promocode Applied');

            if (promoInput && !promoApplied && !isProcessingPromo) {
                updatePanel('🏷️ 正在校验优惠码…');
                promoInput.value = PROMO_CODE;
                if (validateBtn) {
                    isProcessingPromo = true;
                    validateBtn.click();
                    setTimeout(() => (isProcessingPromo = false), 3000);
                }
            }

            if (realTOS && !realTOS.checked) {
                updatePanel('📜 自动勾选条款');
                if (window.jQuery && window.jQuery(realTOS).iCheck) {
                    window.jQuery(realTOS).iCheck('check');
                } else {
                    const helper = document.querySelector('.iCheck-helper');
                    if (helper) helper.click();
                }
                realTOS.checked = true;
            }

            if (
                promoApplied &&
                realTOS &&
                realTOS.checked &&
                tokenInput &&
                tokenInput.value.length > 50
            ) {
                updatePanel('🚀 条件满足<br>📤 提交订单');
                clearInterval(finalRunner);
                checkoutBtn.click();
            }
        }, 400);
    }
})();

PS:另外一种,也可让AI自行修改

// ==UserScript==
// @name         LazyCats VPS 抢购助手(单次点击版)
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  每次页面加载完成只点一次“加入购物车”,避免重复点击
// @author       Qwen
// @match        https://lazycats.online/cart?action=configureproduct&pid=131
// @match        https://lazycats.online/cart?action=viewcart
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // ========== 悬浮面板 ==========
    const panel = document.createElement('div');
    panel.id = 'lazybuy-panel';
    panel.style.cssText = `
        position: fixed;
        right: 12px;
        bottom: 12px;
        z-index: 999999;
        background: rgba(0,0,0,0.85);
        color: #00ffcc;
        padding: 10px 12px;
        font-size: 12px;
        line-height: 1.6;
        border-radius: 8px;
        font-family: Consolas, monospace;
        min-width: 240px;
        box-shadow: 0 0 12px rgba(0,255,204,0.5);
        pointer-events: none;
    `;
    document.body.appendChild(panel);

    let hasClickedThisLoad = false; // 标记本轮是否已点击
    let loadCount = 0;

    function updatePanel(text) {
        panel.innerHTML = `<b>LazyCats 抢购助手</b><br>${text}`;
    }

    // ========== 处理配置页 ==========
    function handleConfigurePage() {
        if (hasClickedThisLoad) return; // 已点过,不再点

        const btn = document.getElementById('addToCartBtn');
        if (!btn) {
            // 按钮未加载,稍后重试(通常不会发生,因 onload 已触发)
            setTimeout(handleConfigurePage, 300);
            return;
        }

        loadCount++;
        hasClickedThisLoad = true;
        btn.click();

        updatePanel(`🖱️ 第 ${loadCount} 次页面加载<br>✅ 已点击“加入购物车”<br>⏳ 等待结果…`);
    }

    // ========== 处理购物车页 ==========
    function handleCartPage() {
        updatePanel('✅ 成功进入购物车!<br>⚙️ 自动勾选条款…');

        const terms = document.getElementById('terms');
        if (terms && !terms.checked) {
            terms.checked = true;
        }

        const checkoutInterval = setInterval(() => {
            const btn = document.querySelector('button.submit-btn[type="submit"]');
            if (btn && !btn.disabled) {
                clearInterval(checkoutInterval);
                updatePanel('🚀 正在提交订单…');
                btn.click();
            }
        }, 200);
    }

    // ========== 主入口 ==========
    const url = new URL(location.href);
    const action = url.searchParams.get('action');

    if (action === 'viewcart') {
        handleCartPage();
        return;
    }

    if (action === 'configureproduct' && url.searchParams.get('pid') === '131') {
        // 监听页面加载完成(包括首次和后续刷新)
        if (document.readyState === 'complete') {
            handleConfigurePage();
        } else {
            window.addEventListener('load', () => {
                handleConfigurePage();
            });
        }

        // 防御性:如果页面动态更新按钮(极少见),可加 MutationObserver,但通常不需要
        return;
    }

    updatePanel('❓ 非目标页面');
})();

已在购物车中了 只勾选和提交

// ==UserScript==
// @name         LazyCats 结账助手(可靠执行版)
// @namespace    http://tampermonkey.net/
// @version      1.4
// @description  轮询检测条款和按钮,一旦存在立即勾选并点击,绝不遗漏
// @author       Qwen
// @match        https://lazycats.online/cart?action=viewcart&statuscart=checkout
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // ========== 悬浮面板 ==========
    const panel = document.createElement('div');
    panel.id = 'lazy-checkout-panel';
    panel.style.cssText = `
        position: fixed;
        right: 12px;
        bottom: 12px;
        z-index: 999999;
        background: rgba(0,0,0,0.85);
        color: #00ffcc;
        padding: 10px 12px;
        font-size: 12px;
        line-height: 1.6;
        border-radius: 8px;
        font-family: Consolas, monospace;
        min-width: 240px;
        box-shadow: 0 0 12px rgba(0,255,204,0.5);
        pointer-events: none;
    `;
    document.body.appendChild(panel);

    let hasExecuted = false;

    function updatePanel(text) {
        panel.innerHTML = `<b>LazyCats 结账助手</b><br>${text}`;
    }

    // ========== 核心:轮询检测并执行 ==========
    function pollAndExecute() {
        if (hasExecuted) return;

        const terms = document.getElementById('terms');
        const btn = document.querySelector('button.btn.btn-primary.w-100.submit-btn[type="submit"]');

        if (terms && btn) {
            hasExecuted = true;

            // 勾选
            if (!terms.checked) {
                terms.checked = true;
                updatePanel('✅ 已勾选服务条款');
            } else {
                updatePanel('ℹ️ 条款已勾选');
            }

            // 点击(即使看起来可点,我们也点一次)
            setTimeout(() => {
                if (btn.offsetParent !== null) { // 确保按钮在页面上(未被 display:none)
                    btn.click();
                    updatePanel('🚀 已点击“立刻结账”');
                }
            }, 100);
            return;
        }

        // 未找到,继续轮询
        updatePanel('⏳ 等待条款与结账按钮…');
        setTimeout(pollAndExecute, 300);
    }

    // 启动
    updatePanel('监听页面元素…');
    pollAndExecute();

})();

 

 

 

© 版权声明
THE END
喜欢就支持一下吧
点赞13 分享