Files
yu-zhi-ran/scripts/show_status_report.py
T
Yuzhiran Dev 233e23016c feat: 内容数据迁移至数据库,合规审查全链路打通
- 文章 HTML 存储从文件系统迁移至 articles 表,删除 releases 目录
- 合规审查从 DB 读取 HTML,审查结果写回 DB,通过后自动推进至待发布
- 新增 todayCount 筛选按钮,与系统概览统计数据一致
- 全屏预览修复:提升 z-index 超过侧边栏,添加退出全屏/关闭按钮
- 统一 '优化' → '审查' 命名,消除前后端术语不一致
- 调度器创作完成后自动触发审查(生成 → 审查 → 待发布)
- 清理旧备份/调试文件、过期大纲和研究笔记
2026-05-13 17:33:56 +08:00

72 lines
2.6 KiB
Python

#!/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")