Files
yu-zhi-ran/platform/IMPLEMENTATION_PLAN.md

111 lines
3.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 实施计划(阶段1-3
## 阶段1: 服务化改造 (预计1-2天)
### 1.1 项目骨架
- [x] 创建 `platform/` 目录结构
- [ ] 创建 `backend/Dockerfile`
- [ ] 创建 `docker-compose.yml`
- [ ] 初始化 `backend/requirements.txt`
- [ ] 创建 `backend/app/main.py` (FastAPI入口)
- [ ] 创建 `backend/app/database.py` (SQLite连接)
- [ ] 创建 `backend/app/models.py` (数据模型)
- [ ] 创建 `backend/app/core/` (封装脚本逻辑)
### 1.2 API 设计
- `GET /api/status` - 系统状态概览
- `GET /api/topics` - 选题列表
- `GET /api/topics/{id}` - 选题详情
- `POST /api/topics/{id}/generate` - 生成内容
- `POST /api/articles/optimize-all` - 合规优化(运行optimizer
- `GET /api/articles/drafts` - 查看草稿
- `POST /api/articles/{id}/publish` - 标记已发布
- `GET /api/logs/{date}` - 查看日志
### 1.3 核心封装
- `core/generator.py` - 调用 `scripts/creator.py`
- `core/optimizer.py` - 调用 `scripts/compliance_optimizer.py`
- `core/publisher.py` - 状态更新(模拟发布)
- `core/collector.py` - 调用 `scripts/collector.py`
### 1.4 数据库模型
```python
class Topic:
id: str
title: str
field: str
status: str # pending, draft, ready, published
priority_score: int
compliance_score: Optional[int]
ready_at: Optional[date]
published_at: Optional[date]
platform_urls: Optional[dict] # {"zhihu": "...", "wechat": "..."}
class Article:
id: str
topic_id: str
platform: str
file_path: str
status: str # draft, optimized, published
created_at: datetime
compliance_score: Optional[int]
```
## 阶段2: 基础Web界面 (预计3-5天)
### 2.1 前端结构
- `frontend/index.html` - 主页面布局
- `frontend/app.js` - Vue 3 应用逻辑
- `frontend/style.css` - 样式
### 2.2 页面与功能
1. **仪表盘**
- 今日状态:生成数、合规率、待发布数
- 快捷操作:手动生成、一键优化
2. **选题管理**
- 表格展示(ID、标题、领域、优先级、状态)
- 筛选:按状态、领域
- 操作:生成、查看详情
3. **内容预览**
- 选题详情模态框
- HTML预览(iframe
- 合规报告展示
4. **发布管理**
- 待发布列表
- 发布向导:选择平台 → 填写链接 → 确认发布
- 已发布历史
5. **日志查看**
- 日期选择
- 日志文件内容展示
### 2.3 API 集成
- 使用 fetch 与后端通信
- 自动刷新状态
- 操作反馈(toast/alert
## 阶段3: 完善与优化 (预计2-3天)
- [ ] 图片上传(封面图、图表)
- [ ] 富文本编辑器(手动修改草稿)
- [ ] 批量操作(批量生成、批量发布)
- [ ] 定时任务配置界面(编辑cron
- [ ] 数据导出(选题库、发布记录)
- [ ] 系统监控(CPU、内存、磁盘)
- [ ] 容器日志查看
## 滚动任务
- [ ] 编写 Dockerfile (backend + nginx)
- [ ] 配置 docker-compose.yml
- [ ] 测试端到端流程
- [ ] 编写 README(部署、使用说明)
## 时间估计
- 阶段1: 4-8小时
- 阶段2: 8-12小时
- 阶段3: 4-8小时
总计: 16-28小时