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));