修正: ①日报仅18点收队统一发送(异常中止只发告警不再触发日报) ②二维码截图前强制reload登录页拿新码
This commit is contained in:
+3
-19
@@ -121,28 +121,12 @@ function runBatch() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- 日报 ----------
|
// 发日报的唯一入口:仅 18 点收队时调用(2026-08-27 用户定稿:统计汇报只在18点发,异常中止只发告警不发日报)
|
||||||
function maybeSendReport(myStatus, chatLeft) {
|
function maybeSendReport(myStatus, chatLeft) {
|
||||||
writeState(myStatus, chatLeft);
|
writeState(myStatus, chatLeft);
|
||||||
if (reportAlreadySent()) { log('日报今日已发过,跳过'); return; }
|
// 仅记录状态,日报由 18:05 收队任务统一生成发送
|
||||||
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)}`); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function statusText(s) {
|
function statusText(s) {
|
||||||
if (s === 'kicked_out') return '🚨 被顶号(他处登录)';
|
if (s === 'kicked_out') return '🚨 被顶号(他处登录)';
|
||||||
if (s === 'login_expired') return '🚨 登录失效';
|
if (s === 'login_expired') return '🚨 登录失效';
|
||||||
|
|||||||
@@ -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 p.goto('https://passport.zhaopin.com/org/login', { waitUntil: 'domcontentloaded', timeout: 60000 }).catch(() => {});
|
||||||
await new Promise(r => setTimeout(r, 4000));
|
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));
|
console.log('PAGE:', p.url().slice(0, 90));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user