#!/usr/bin/env node /** * 酷狗概念版 · 提现巡检入口(青龙窗口抢库存用) * 只做三件事:读余额 → 读提现档位 → 余额够且有库存就申请,不跑任务/签到。 * 用法:task kugou_withdraw.js * * 防重:单实例锁(._withdraw.lock) * 超时:动态 —— 若需要等整点,时限自动放宽到「等待时长 + 90 秒」, * 不会被固定的 60 秒误杀(v2.0 修复)。 * cron "50 11,17 * * *" kugou_withdraw.js * new Env('酷狗概念版(提现巡检)'); */ 'use strict'; const lock = require('./_lock.js'); const align = require('./_align.js'); if (!lock.acquire('withdraw')) { console.log('[跳过] 已有一份提现巡检在运行,本次直接退出'); process.exit(0); } // 先按本地时间估算要不要等整点,据此决定总时限 const maxWait = Number(process.env.KG_ALIGN_MAX_WAIT_MS || 130000); const postMs = Number(process.env.KG_ALIGN_POST_MS || 80); const waitMs = align.msToNextWindow(Date.now(), 0); const needWait = waitMs <= maxWait ? Math.max(0, waitMs + postMs) : 0; const budget = needWait + 90000; // 等待时间 + 90 秒执行余量 const dog = lock.deadline(budget, 'withdraw'); if (needWait > 0) { console.log('[提现巡检] 需等待 ' + (needWait / 1000).toFixed(1) + ' 秒到整点,看门狗时限已放宽到 ' + Math.round(budget / 1000) + ' 秒'); } process.env.KG_ONLY_WITHDRAW = '1'; require('./kugou_concept_daily.js');