日报按开工情况裁剪(v1.2): 双账号均无数据→不发空消息; 单账号开工→只发该账号(总览/小节/资源表均剔除未开工账号)

This commit is contained in:
hermes
2026-09-11 13:00:04 +00:00
parent 4e4cec3e1b
commit e6f5fd61bd
4 changed files with 50 additions and 19 deletions
+12 -5
View File
@@ -100,11 +100,18 @@ const sentFlag = path.join(STATE_DIR, `report-sent-${today()}`);
} catch { }
}
const md = execSync(`node ${SCRIPTS}/daily-report.js`, { cwd: SCRIPTS, encoding: 'utf8', timeout: 60000, env });
fs.writeFileSync(`/tmp/daily-report-enforce-${today()}.md`, md);
execSync(`${HERMES} send -t "feishu:${GROUP}" -f /tmp/daily-report-enforce-${today()}.md`, { stdio: ['pipe', 'pipe', 'pipe'], timeout: 60000 });
fs.writeFileSync(sentFlag, new Date().toISOString());
reportSent = true;
log('日报已发送到群 ✅');
// v1.2(2026-09-02 用户定稿):两个账号都没开工 → 日报输出为空 → 不发送
if (!md.trim()) {
log('双账号今日均无数据,日报不发送(不发空消息)');
fs.writeFileSync(sentFlag, new Date().toISOString());
reportSent = 'skipped_empty';
} else {
fs.writeFileSync(`/tmp/daily-report-enforce-${today()}.md`, md);
execSync(`${HERMES} send -t "feishu:${GROUP}" -f /tmp/daily-report-enforce-${today()}.md`, { stdio: ['pipe', 'pipe', 'pipe'], timeout: 60000 });
fs.writeFileSync(sentFlag, new Date().toISOString());
reportSent = true;
log('日报已发送到群 ✅');
}
} catch (e) { findings.push(`日报发送失败: ${String(e.message).slice(0, 150)}`); }
}