feat: 内容数据迁移至数据库,合规审查全链路打通

- 文章 HTML 存储从文件系统迁移至 articles 表,删除 releases 目录
- 合规审查从 DB 读取 HTML,审查结果写回 DB,通过后自动推进至待发布
- 新增 todayCount 筛选按钮,与系统概览统计数据一致
- 全屏预览修复:提升 z-index 超过侧边栏,添加退出全屏/关闭按钮
- 统一 '优化' → '审查' 命名,消除前后端术语不一致
- 调度器创作完成后自动触发审查(生成 → 审查 → 待发布)
- 清理旧备份/调试文件、过期大纲和研究笔记
This commit is contained in:
Yuzhiran Dev
2026-05-13 17:33:56 +08:00
parent bc6a302e59
commit 233e23016c
234 changed files with 5670 additions and 10651 deletions
+19 -35
View File
@@ -1,46 +1,30 @@
#!/usr/bin/env python3
import sys
from pathlib import Path
from datetime import datetime
PROJECT_ROOT = Path(__file__).parent.parent
sys.path.insert(0, str(PROJECT_ROOT))
try:
from db_helper import update_topic_status
from app.database import SessionLocal
from app.models import Topic as DBTopic
HAVE_DB = True
except ImportError:
HAVE_DB = False
DATA_DIR = PROJECT_ROOT / "automation" / "data"
TOPICS_FILE = DATA_DIR / "sustainability_topics.json"
sys.path.insert(0, str(PROJECT_ROOT / 'platform' / 'backend'))
from app.database import SessionLocal
from app.models import Topic as DBTopic
def adjust(adjustments):
db_ok = False
if HAVE_DB:
db = SessionLocal()
try:
for tid, new_score in adjustments.items():
topic = db.query(DBTopic).filter(DBTopic.id == tid).first()
if topic:
topic.priority_score = new_score
topic.updated_at = datetime.datetime.now()
db.commit()
db_ok = True
finally:
db.close()
db = SessionLocal()
try:
with open(TOPICS_FILE, 'r', encoding='utf-8') as f:
topics = json.load(f)
for t in topics:
if t['id'] in adjustments:
t['priority_score'] = adjustments[t['id']]
with open(TOPICS_FILE, 'w', encoding='utf-8') as f:
json.dump(topics, f, ensure_ascii=False, indent=2)
except:
pass
return db_ok
for tid, new_score in adjustments.items():
topic = db.query(DBTopic).filter(DBTopic.id == tid).first()
if topic:
topic.priority_score = new_score
topic.updated_at = datetime.now()
db.commit()
finally:
db.close()
def main():
adjustments = {'B05': 15}
adjust(adjustments)
adjust({'B05': 15})
print("B05 priority_score set to 15")
if __name__ == "__main__":
import json, datetime
main()