#!/usr/bin/env python3 import sys, datetime from pathlib import Path from collections import Counter PROJECT_ROOT = Path(__file__).parent.parent sys.path.insert(0, str(PROJECT_ROOT)) from db_helper import export_topics_to_json DATA_DIR = PROJECT_ROOT / "automation" / "data" TODAY = datetime.date.today().isoformat() releases_dir = DATA_DIR / "releases" / TODAY drafts_dir = DATA_DIR / "drafts" / TODAY topics = export_topics_to_json() by_status = {} for t in topics: s = t.get('status', '待处理') by_status.setdefault(s, []).append(t) print(f"\U0001f4ca 宇之然内容生成系统状态报告 ({TODAY})") print(f"\n=== 1. 选题库总览 ===") print(f"总选题数: {len(topics)}") for s, arr in sorted(by_status.items()): print(f" {s}: {len(arr)} 个") print(f"\n=== 2. 今日 ({TODAY}) 已生成内容 ===") if releases_dir.exists(): zhihu = list((releases_dir / 'zhihu').glob('*.html')) if (releases_dir / 'zhihu').exists() else [] wechat = list((releases_dir / 'wechat').glob('*.html')) if (releases_dir / 'wechat').exists() else [] xhs = list((releases_dir / 'xiaohongshu').glob('*.html')) if (releases_dir / 'xiaohongshu').exists() else [] print(f" 知乎: {len(zhihu)} 篇") print(f" 微信公众号: {len(wechat)} 篇") print(f" 小红书: {len(xhs)} 篇") topic_ids = set() for f in zhihu: topic_ids.add(f.stem.split('_')[1]) if topic_ids: print(f" 涉及选题ID: {', '.join(sorted(topic_ids))}") else: print(" 今日无发布内容") report_file = drafts_dir / "optimization_report.json" if report_file.exists(): import json report = json.loads(report_file.read_text(encoding='utf-8')) print(f"\n=== 3. 合规优化结果 ===") sm = report['summary'] print(f" 总文章数: {sm['total_articles']}") print(f" 自动通过: {sm['passed_auto']} 篇") print(f" 需人工审核: {sm['need_manual']} 篇") print(f" 平均合规分: {sm['average_score']:.1f}") if sm['need_manual'] == 0: print(" ✅ 所有文章均已自动合规") else: print(f"\n=== 3. 合规优化结果 ===") print(" 未找到优化报告") ready = by_status.get('ready', []) print(f"\n=== 4. 待发布选题(已合规)===") if ready: for t in sorted(ready, key=lambda x: x.get('priority_score', 0), reverse=True): print(f" {t['id']}: {t['title'][:50]}") else: print(" 暂无待发布选题") print(f"\n=== 5. 操作提示 ===") print("1. 人工发布:将「待发布」选题的HTML发布到对应平台") print("2. 发布后运行: python3 scripts/mark_published.py <选题ID>") print("3. 或批量发布: python3 scripts/mark_published.py --all-ready")