From df0a294a43778d803fdd85055c73be5862d69b89 Mon Sep 17 00:00:00 2001 From: hermes Date: Thu, 27 Aug 2026 03:13:14 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3:=20=E2=91=A0=E6=97=A5?= =?UTF-8?q?=E6=8A=A5=E4=BB=8518=E7=82=B9=E6=94=B6=E9=98=9F=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E5=8F=91=E9=80=81(=E5=BC=82=E5=B8=B8=E4=B8=AD?= =?UTF-8?q?=E6=AD=A2=E5=8F=AA=E5=8F=91=E5=91=8A=E8=AD=A6=E4=B8=8D=E5=86=8D?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E6=97=A5=E6=8A=A5)=20=E2=91=A1=E4=BA=8C?= =?UTF-8?q?=E7=BB=B4=E7=A0=81=E6=88=AA=E5=9B=BE=E5=89=8D=E5=BC=BA=E5=88=B6?= =?UTF-8?q?reload=E7=99=BB=E5=BD=95=E9=A1=B5=E6=8B=BF=E6=96=B0=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/daily-runner.js | 22 +++------------------- scripts/login-qrcode.js | 4 ++++ 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/scripts/daily-runner.js b/scripts/daily-runner.js index 888e62c..3a3f110 100644 --- a/scripts/daily-runner.js +++ b/scripts/daily-runner.js @@ -121,28 +121,12 @@ function runBatch() { }); } -// ---------- 日报 ---------- +// 发日报的唯一入口:仅 18 点收队时调用(2026-08-27 用户定稿:统计汇报只在18点发,异常中止只发告警不发日报) function maybeSendReport(myStatus, chatLeft) { writeState(myStatus, chatLeft); - if (reportAlreadySent()) { log('日报今日已发过,跳过'); return; } - const other = readOtherState(); - // 对方已结束(done/login_expired/alert/无状态)→ 我来发;对方还在跑 → 对方结束时发 - const otherDone = !other || other.status !== 'running'; - if (!otherDone) { log(`对方(${OTHER})仍在运行,日报由对方结束时发送`); return; } - try { - const md = execSync(`node ${SCRIPTS}/daily-report.js`, { - cwd: SCRIPTS, encoding: 'utf8', timeout: 60000, - env: { ...process.env, CHAT_LEFT_HR1: ACCT === 'hr1' ? chatLeft : other?.chatLeft, CHAT_LEFT_HR2: ACCT === 'hr2' ? chatLeft : other?.chatLeft, - HR1_STATUS: ACCT === 'hr1' ? statusText(myStatus) : statusText(other?.status), - HR2_STATUS: ACCT === 'hr2' ? statusText(myStatus) : statusText(other?.status) }, - }); - fs.writeFileSync(`/tmp/daily-report-${today()}.md`, md); - execSync(`${HERMES} send -t "feishu:${GROUP}" -f /tmp/daily-report-${today()}.md`, - { stdio: ['pipe', 'pipe', 'pipe'], timeout: 60000 }); - markReportSent(); - log('日报已发送到群'); - } catch (e) { log(`日报生成/发送失败: ${String(e.message).slice(0, 150)}`); } + // 仅记录状态,日报由 18:05 收队任务统一生成发送 } + function statusText(s) { if (s === 'kicked_out') return '🚨 被顶号(他处登录)'; if (s === 'login_expired') return '🚨 登录失效'; diff --git a/scripts/login-qrcode.js b/scripts/login-qrcode.js index 0db6af4..d8b8158 100644 --- a/scripts/login-qrcode.js +++ b/scripts/login-qrcode.js @@ -30,6 +30,10 @@ const OUT = process.argv[3] || `/tmp/zhaopin-login-qr-${PORT}.png`; await p.goto('https://passport.zhaopin.com/org/login', { waitUntil: 'domcontentloaded', timeout: 60000 }).catch(() => {}); await new Promise(r => setTimeout(r, 4000)); } + } else { + // 已在登录页:强制 reload 拿新二维码(页面上停留的旧码可能已过期) + await p.reload({ waitUntil: 'domcontentloaded', timeout: 60000 }).catch(() => {}); + await new Promise(r => setTimeout(r, 4000)); } console.log('PAGE:', p.url().slice(0, 90));