fix: connect API to tracker.db via SQLite repository
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Phase 4 任务数据初始化脚本
|
||||
将认证、权限、订阅计费的所有任务录入推进器
|
||||
"""
|
||||
import sys
|
||||
import io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
|
||||
import requests
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
API_BASE = "http://47.98.113.167:8089/api/v1"
|
||||
PROJECT_ID = "00000000-0000-0000-0000-000000000001"
|
||||
WORKSPACE_ID = "00000000-0000-0000-0000-000000000001"
|
||||
|
||||
def create_milestone(name, target_date, description=""):
|
||||
"""创建里程碑"""
|
||||
payload = {
|
||||
"name": name,
|
||||
"target_date": target_date,
|
||||
"project_id": PROJECT_ID,
|
||||
"workspace_id": WORKSPACE_ID,
|
||||
"description": description
|
||||
}
|
||||
resp = requests.post(f"{API_BASE}/project-management/milestones", json=payload)
|
||||
if resp.status_code == 200:
|
||||
print(f"[OK] 里程碑: {name}")
|
||||
return resp.json()
|
||||
else:
|
||||
print(f"[FAIL] 里程碑: {name} - {resp.text}")
|
||||
return None
|
||||
|
||||
def create_task(name, description, priority="medium"):
|
||||
"""创建任务"""
|
||||
payload = {
|
||||
"name": name,
|
||||
"description": description,
|
||||
"project_id": PROJECT_ID,
|
||||
"workspace_id": WORKSPACE_ID,
|
||||
"priority": priority,
|
||||
}
|
||||
resp = requests.post(f"{API_BASE}/project-management/tasks", json=payload)
|
||||
if resp.status_code == 200:
|
||||
print(f" [OK] {name}")
|
||||
return resp.json()
|
||||
else:
|
||||
print(f" [FAIL] {name}")
|
||||
return None
|
||||
|
||||
def main():
|
||||
print("=" * 60)
|
||||
print("Phase 4: SAAS 产品化 - 任务初始化")
|
||||
print("=" * 60)
|
||||
|
||||
# ========== Milestone 1: 认证与账号体系 ==========
|
||||
print("\n[1/4] 创建里程碑:认证与账号体系...")
|
||||
create_milestone(
|
||||
"认证与账号体系",
|
||||
"2026-06-23",
|
||||
"JWT 登录、注册、密码管理、Session 管理"
|
||||
)
|
||||
|
||||
print("\n 录入任务...")
|
||||
|
||||
# Day 1-2: 基础设施
|
||||
create_task("JWT 工具类实现", "sign/verify/refresh Token 功能", "high")
|
||||
create_task("bcrypt 密码哈希工具", "密码加密存储", "high")
|
||||
create_task("Redis Session 存储", "refresh_token 存储和管理", "high")
|
||||
create_task("邮件服务封装", "SMTP + 邮件模板(欢迎/验证/重置)", "medium")
|
||||
create_task("User 实体扩展", "新增 password_hash/email_verified 等字段", "high")
|
||||
|
||||
# Day 3-4: 核心认证
|
||||
create_task("注册 API", "邮箱 + 密码注册,发送验证邮件", "urgent")
|
||||
create_task("登录 API", "JWT 签发 access_token + refresh_token", "urgent")
|
||||
create_task("登出 API", "撤销 refresh_token", "high")
|
||||
create_task("刷新 Token API", "用 refresh_token 换取新 access_token", "high")
|
||||
create_task("密码重置流程", "忘记密码 + 邮件重置链接", "medium")
|
||||
|
||||
# Day 5-6: Session 管理
|
||||
create_task("Session 实体与 Repository", "存储设备信息、IP、过期时间", "medium")
|
||||
create_task("活跃 Session 列表 API", "查看所有登录设备", "low")
|
||||
create_task("强制登出所有设备", "撤销所有 refresh_token", "medium")
|
||||
create_task("设备信息解析", "解析 User-Agent 识别设备类型", "low")
|
||||
|
||||
# Day 7: 测试与文档
|
||||
create_task("认证集成测试", "注册/登录/登出/刷新完整流程", "high")
|
||||
create_task("认证安全测试", "密码强度/Token 伪造/暴力破解防护", "urgent")
|
||||
create_task("认证 API 文档更新", "OpenAPI 规范更新", "low")
|
||||
|
||||
# ========== Milestone 2: 多租户权限体系 ==========
|
||||
print("\n[2/4] 创建里程碑:多租户权限体系...")
|
||||
create_milestone(
|
||||
"多租户权限体系",
|
||||
"2026-06-30",
|
||||
"4 种角色、成员管理、邀请系统、数据隔离"
|
||||
)
|
||||
|
||||
print("\n 录入任务...")
|
||||
|
||||
# Day 1-2: 权限基础
|
||||
create_task("WorkspaceMembership 实体", "成员关系、角色存储", "high")
|
||||
create_task("WorkspaceRole 枚举", "Owner/Admin/Member/Viewer 权限定义", "high")
|
||||
create_task("权限检查中间件", "@require_permission 装饰器", "urgent")
|
||||
create_task("数据隔离过滤器", "所有查询自动加 workspace_id", "urgent")
|
||||
|
||||
# Day 3-4: 成员管理
|
||||
create_task("邀请成员 API", "发送邀请邮件 + 生成邀请令牌", "high")
|
||||
create_task("接受/拒绝邀请 API", "处理邀请状态", "high")
|
||||
create_task("移除成员 API", "删除 WorkspaceMembership", "medium")
|
||||
create_task("修改成员角色 API", "Owner/Admin 可修改其他人角色", "medium")
|
||||
create_task("转让 Workspace 所有权", "Owner 转让给其他成员", "low")
|
||||
|
||||
# Day 5-6: 权限验证
|
||||
create_task("为所有现有 API 加权限检查", "项目/任务/素材 API 权限保护", "urgent")
|
||||
create_task("跨 Workspace 访问防护测试", "确保数据隔离无漏洞", "urgent")
|
||||
create_task("权限矩阵验证", "测试各角色权限边界", "high")
|
||||
|
||||
# Day 7: 测试与文档
|
||||
create_task("权限系统集成测试", "各角色操作权限完整测试", "high")
|
||||
create_task("数据隔离安全测试", "跨 Workspace 攻击测试", "urgent")
|
||||
create_task("权限 API 文档更新", "成员管理 API 文档", "low")
|
||||
|
||||
# ========== Milestone 3: 订阅与计费 ==========
|
||||
print("\n[3/4] 创建里程碑:订阅与计费...")
|
||||
create_milestone(
|
||||
"订阅与计费体系",
|
||||
"2026-07-07",
|
||||
"3 种套餐、支付宝/微信支付、账单管理"
|
||||
)
|
||||
|
||||
print("\n 录入任务...")
|
||||
|
||||
# Day 1-2: 订阅基础
|
||||
create_task("Subscription 实体与 Repository", "订阅状态、套餐、到期时间", "high")
|
||||
create_task("SubscriptionPlan 枚举", "free/pro/enterprise 套餐定义", "high")
|
||||
create_task("配额检查工具", "检查 Workspace/项目/存储限制", "high")
|
||||
create_task("套餐限制中间件", "创建资源前检查配额", "urgent")
|
||||
|
||||
# Day 3-4: 支付集成
|
||||
create_task("支付宝 SDK 集成", "生成支付二维码", "high")
|
||||
create_task("微信支付 SDK 集成", "生成支付二维码", "high")
|
||||
create_task("创建支付订单 API", "用户选择套餐 → 生成订单", "high")
|
||||
create_task("支付回调处理", "验证签名 + 更新订单状态 + 激活订阅", "urgent")
|
||||
|
||||
# Day 5-6: 账单管理
|
||||
create_task("Invoice 实体与 Repository", "账单记录存储", "medium")
|
||||
create_task("生成账单 PDF", "使用模板生成 PDF 发票", "low")
|
||||
create_task("账单列表/下载 API", "用户查看历史账单", "medium")
|
||||
create_task("订阅历史记录", "订阅变更历史追踪", "low")
|
||||
|
||||
# Day 7: 测试与文档
|
||||
create_task("支付流程端到端测试", "沙箱环境完整支付流程", "high")
|
||||
create_task("配额检查测试", "超出限制时正确拦截", "high")
|
||||
create_task("计费 API 文档更新", "订阅/支付/账单 API 文档", "low")
|
||||
|
||||
# ========== Milestone 4: 前端集成与上线 ==========
|
||||
print("\n[4/4] 创建里程碑:前端集成与上线...")
|
||||
create_milestone(
|
||||
"前端集成与上线",
|
||||
"2026-07-14",
|
||||
"认证 UI、权限 UI、订阅 UI、端到端测试、生产部署"
|
||||
)
|
||||
|
||||
print("\n 录入任务...")
|
||||
|
||||
# Day 1-2: 认证 UI
|
||||
create_task("登录页面", "邮箱/密码登录表单 + 记住我", "high")
|
||||
create_task("注册页面", "邮箱注册 + 密码强度提示", "high")
|
||||
create_task("忘记密码页面", "邮箱重置流程", "medium")
|
||||
create_task("邮箱验证提示", "注册后验证邮件提醒", "low")
|
||||
|
||||
# Day 3-4: 权限 UI
|
||||
create_task("成员管理页面", "Workspace 成员列表 + 角色显示", "high")
|
||||
create_task("邀请成员弹窗", "输入邮箱 + 选择角色", "medium")
|
||||
create_task("角色选择器组件", "下拉选择 Owner/Admin/Member/Viewer", "low")
|
||||
create_task("权限说明文档", "各角色权限说明页面", "low")
|
||||
|
||||
# Day 5-6: 订阅 UI
|
||||
create_task("套餐选择页面", "免费版/专业版/企业版对比表", "high")
|
||||
create_task("支付二维码页面", "显示支付宝/微信二维码 + 轮询支付状态", "high")
|
||||
create_task("账单管理页面", "历史账单列表 + 下载", "medium")
|
||||
create_task("配额使用展示", "当前 Workspace/项目/存储使用情况", "medium")
|
||||
|
||||
# Day 7: 上线准备
|
||||
create_task("Phase 4 端到端测试", "注册 → 邀请成员 → 付费 → 使用完整流程", "urgent")
|
||||
create_task("Phase 4 性能测试", "登录/权限检查响应时间测试", "high")
|
||||
create_task("Phase 4 安全审计", "SQL注入/XSS/CSRF/Token安全检查", "urgent")
|
||||
create_task("Phase 4 生产环境部署", "部署到服务器 + 灰度发布", "high")
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("[OK] Phase 4 所有任务已录入推进器!")
|
||||
print("=" * 60)
|
||||
print("\n访问推进器: http://47.98.113.167:8088/projects")
|
||||
print("共创建 4 个里程碑 + 68 个任务\n")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,8 +1,13 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
小虾 SaaS 项目推进器数据初始化脚本
|
||||
将当前项目状态、规则、待办事项录入推进器
|
||||
"""
|
||||
import sys
|
||||
import io
|
||||
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||||
|
||||
import requests
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
@@ -14,10 +19,10 @@ API_BASE = "http://47.98.113.167:8089/api/v1"
|
||||
PROJECT_ID = "00000000-0000-0000-0000-000000000001"
|
||||
WORKSPACE_ID = "00000000-0000-0000-0000-000000000001"
|
||||
|
||||
def create_milestone(title, target_date, description=""):
|
||||
def create_milestone(name, target_date, description=""):
|
||||
"""创建里程碑"""
|
||||
payload = {
|
||||
"title": title,
|
||||
"name": name,
|
||||
"target_date": target_date,
|
||||
"project_id": PROJECT_ID,
|
||||
"workspace_id": WORKSPACE_ID,
|
||||
@@ -25,30 +30,27 @@ def create_milestone(title, target_date, description=""):
|
||||
}
|
||||
resp = requests.post(f"{API_BASE}/project-management/milestones", json=payload)
|
||||
if resp.status_code == 200:
|
||||
print(f"✅ 里程碑创建成功: {title}")
|
||||
print(f"[OK] 里程碑创建成功: {name}")
|
||||
return resp.json()
|
||||
else:
|
||||
print(f"❌ 里程碑创建失败: {title} - {resp.text}")
|
||||
print(f"[FAIL] 里程碑创建失败: {name} - {resp.text}")
|
||||
return None
|
||||
|
||||
def create_task(title, description, priority="MEDIUM", status="PENDING", progress=0, tags=None):
|
||||
def create_task(name, description, priority="medium", status="pending", progress=0, tags=None):
|
||||
"""创建任务"""
|
||||
payload = {
|
||||
"title": title,
|
||||
"name": name,
|
||||
"description": description,
|
||||
"project_id": PROJECT_ID,
|
||||
"workspace_id": WORKSPACE_ID,
|
||||
"priority": priority,
|
||||
"status": status,
|
||||
"progress": progress,
|
||||
"tags": tags or []
|
||||
}
|
||||
resp = requests.post(f"{API_BASE}/project-management/tasks", json=payload)
|
||||
if resp.status_code == 200:
|
||||
print(f"✅ 任务创建成功: {title}")
|
||||
print(f"[OK] 任务创建成功: {name}")
|
||||
return resp.json()
|
||||
else:
|
||||
print(f"❌ 任务创建失败: {title} - {resp.text}")
|
||||
print(f"[FAIL] 任务创建失败: {name} - {resp.text}")
|
||||
return None
|
||||
|
||||
def main():
|
||||
@@ -57,97 +59,97 @@ def main():
|
||||
print("=" * 60)
|
||||
|
||||
# ========== 里程碑 ==========
|
||||
print("\n📍 创建里程碑...")
|
||||
print("\n[1/4] 创建里程碑...")
|
||||
|
||||
milestones = [
|
||||
{
|
||||
"title": "Phase 1: 核心平台层完成",
|
||||
"name": "Phase 1: 核心平台层完成",
|
||||
"target_date": "2026-06-15",
|
||||
"description": "Clean Architecture 骨架 + 核心业务对象 + 完整测试"
|
||||
},
|
||||
{
|
||||
"title": "Phase 2: 项目管理模块落地",
|
||||
"name": "Phase 2: 项目管理模块落地",
|
||||
"target_date": "2026-06-16",
|
||||
"description": "任务/里程碑/问题管理 + 前后端完整链路"
|
||||
},
|
||||
{
|
||||
"title": "Phase 3: 部署与备案完成",
|
||||
"name": "Phase 3: 部署与备案完成",
|
||||
"target_date": "2026-06-30",
|
||||
"description": "生产环境部署 + HTTPS 证书 + 域名备案通过"
|
||||
},
|
||||
{
|
||||
"title": "Phase 4: SAAS 产品化完成",
|
||||
"name": "Phase 4: SAAS 产品化完成",
|
||||
"target_date": "2026-07-15",
|
||||
"description": "多租户 + 权限体系 + 订阅计费"
|
||||
},
|
||||
{
|
||||
"title": "Phase 5: AI 剪辑能力接入",
|
||||
"name": "Phase 5: AI 剪辑能力接入",
|
||||
"target_date": "2026-08-01",
|
||||
"description": "视频分类模型 + 自动剪辑 + 配音合成"
|
||||
}
|
||||
]
|
||||
|
||||
for m in milestones:
|
||||
create_milestone(m["title"], m["target_date"], m["description"])
|
||||
create_milestone(m["name"], m["target_date"], m["description"])
|
||||
|
||||
# ========== 已完成任务 ==========
|
||||
print("\n✅ 录入已完成任务...")
|
||||
print("\n[OK] 录入已完成任务...")
|
||||
|
||||
completed_tasks = [
|
||||
{
|
||||
"title": "Clean Architecture 架构设计",
|
||||
"name": "Clean Architecture 架构设计",
|
||||
"description": "Domain → Ports → Application → Adapters 分层完成",
|
||||
"status": "COMPLETED",
|
||||
"progress": 100,
|
||||
"priority": "URGENT",
|
||||
"priority": "urgent",
|
||||
"tags": ["架构", "Phase1"]
|
||||
},
|
||||
{
|
||||
"title": "核心业务对象实现",
|
||||
"name": "核心业务对象实现",
|
||||
"description": "User/Workspace/Project/AssetLibrary/Asset/IngestJob/ClassificationJob 全部完成",
|
||||
"status": "COMPLETED",
|
||||
"progress": 100,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["业务逻辑", "Phase1"]
|
||||
},
|
||||
{
|
||||
"title": "双持久化实现",
|
||||
"name": "双持久化实现",
|
||||
"description": "In-Memory (测试) + SQLAlchemy (生产) 完成",
|
||||
"status": "COMPLETED",
|
||||
"progress": 100,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["数据库", "Phase1"]
|
||||
},
|
||||
{
|
||||
"title": "项目管理模块开发",
|
||||
"name": "项目管理模块开发",
|
||||
"description": "任务/里程碑/问题 三大实体 + 11 个 Use Cases + 11 个 API",
|
||||
"status": "COMPLETED",
|
||||
"progress": 100,
|
||||
"priority": "URGENT",
|
||||
"priority": "urgent",
|
||||
"tags": ["项目管理", "Phase2"]
|
||||
},
|
||||
{
|
||||
"title": "项目推进器前端开发",
|
||||
"name": "项目推进器前端开发",
|
||||
"description": "5 个页面 + 3 个表单 + 完整前后端集成",
|
||||
"status": "COMPLETED",
|
||||
"progress": 100,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["前端", "Phase2"]
|
||||
},
|
||||
{
|
||||
"title": "Docker Compose 部署",
|
||||
"name": "Docker Compose 部署",
|
||||
"description": "5 个容器 (postgres/redis/api/worker/web) 全部运行",
|
||||
"status": "COMPLETED",
|
||||
"progress": 100,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["部署", "Phase3"]
|
||||
},
|
||||
{
|
||||
"title": "Nginx 反向代理配置",
|
||||
"name": "Nginx 反向代理配置",
|
||||
"description": "8088/8089 临时端口配置完成,绕过备案限制",
|
||||
"status": "COMPLETED",
|
||||
"progress": 100,
|
||||
"priority": "MEDIUM",
|
||||
"priority": "medium",
|
||||
"tags": ["部署", "Phase3"]
|
||||
}
|
||||
]
|
||||
@@ -156,23 +158,23 @@ def main():
|
||||
create_task(**task)
|
||||
|
||||
# ========== 进行中任务 ==========
|
||||
print("\n🔄 录入进行中任务...")
|
||||
print("\n[2/4] 录入进行中任务...")
|
||||
|
||||
in_progress_tasks = [
|
||||
{
|
||||
"title": "域名备案审核",
|
||||
"name": "域名备案审核",
|
||||
"description": "saas.xiaoxiajianji.com / saas-api.xiaoxiajianji.com 等待工信部审核通过",
|
||||
"status": "IN_PROGRESS",
|
||||
"progress": 50,
|
||||
"priority": "URGENT",
|
||||
"priority": "urgent",
|
||||
"tags": ["部署", "Phase3", "阻塞"]
|
||||
},
|
||||
{
|
||||
"title": "HTTPS 证书申请",
|
||||
"name": "HTTPS 证书申请",
|
||||
"description": "Let's Encrypt 证书,等待备案通过后申请",
|
||||
"status": "BLOCKED",
|
||||
"progress": 0,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["部署", "Phase3", "依赖备案"]
|
||||
}
|
||||
]
|
||||
@@ -181,103 +183,103 @@ def main():
|
||||
create_task(**task)
|
||||
|
||||
# ========== 待办任务 ==========
|
||||
print("\n📋 录入待办任务...")
|
||||
print("\n[3/4] 录入待办任务...")
|
||||
|
||||
pending_tasks = [
|
||||
{
|
||||
"title": "切换到正式域名和 HTTPS",
|
||||
"name": "切换到正式域名和 HTTPS",
|
||||
"description": "备案通过后:改回 80/443 端口 + 申请证书 + nginx 配置 HTTPS",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["部署", "Phase3", "依赖备案"]
|
||||
},
|
||||
{
|
||||
"title": "PostgreSQL 生产环境切换",
|
||||
"name": "PostgreSQL 生产环境切换",
|
||||
"description": "当前用 In-Memory,需切换到 PostgreSQL + 数据持久化验证",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["数据库", "Phase3"]
|
||||
},
|
||||
{
|
||||
"title": "前端环境变量配置",
|
||||
"name": "前端环境变量配置",
|
||||
"description": "API 地址从临时端口改为正式域名 https://saas-api.xiaoxiajianji.com",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "MEDIUM",
|
||||
"priority": "medium",
|
||||
"tags": ["前端", "Phase3", "依赖备案"]
|
||||
},
|
||||
{
|
||||
"title": "甘特图视图开发",
|
||||
"name": "甘特图视图开发",
|
||||
"description": "项目推进器增加甘特图/时间线视图,可视化任务时间规划",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "MEDIUM",
|
||||
"priority": "medium",
|
||||
"tags": ["前端", "Phase2"]
|
||||
},
|
||||
{
|
||||
"title": "批量操作 API",
|
||||
"name": "批量操作 API",
|
||||
"description": "任务批量更新状态/优先级/删除接口",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "LOW",
|
||||
"priority": "low",
|
||||
"tags": ["后端", "Phase2"]
|
||||
},
|
||||
{
|
||||
"title": "数据导出功能",
|
||||
"name": "数据导出功能",
|
||||
"description": "导出任务列表为 Excel/CSV",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "LOW",
|
||||
"priority": "low",
|
||||
"tags": ["功能", "Phase2"]
|
||||
},
|
||||
{
|
||||
"title": "多租户权限体系",
|
||||
"name": "多租户权限体系",
|
||||
"description": "Workspace 级别权限控制 + 用户角色管理",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "URGENT",
|
||||
"priority": "urgent",
|
||||
"tags": ["权限", "Phase4"]
|
||||
},
|
||||
{
|
||||
"title": "认证与账号体系",
|
||||
"name": "认证与账号体系",
|
||||
"description": "JWT 登录 + 注册 + 密码重置",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "URGENT",
|
||||
"priority": "urgent",
|
||||
"tags": ["认证", "Phase4"]
|
||||
},
|
||||
{
|
||||
"title": "订阅与计费体系",
|
||||
"name": "订阅与计费体系",
|
||||
"description": "SaaS 订阅套餐 + 支付接入(微信/支付宝)",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["商业化", "Phase4"]
|
||||
},
|
||||
{
|
||||
"title": "视频分类模型接入",
|
||||
"name": "视频分类模型接入",
|
||||
"description": "真实 AI 模型替换占位分类逻辑",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "URGENT",
|
||||
"priority": "urgent",
|
||||
"tags": ["AI", "Phase5"]
|
||||
},
|
||||
{
|
||||
"title": "自动剪辑能力",
|
||||
"name": "自动剪辑能力",
|
||||
"description": "视频自动剪辑 + 转场特效 + 字幕生成",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "HIGH",
|
||||
"priority": "high",
|
||||
"tags": ["AI", "Phase5"]
|
||||
},
|
||||
{
|
||||
"title": "配音合成能力",
|
||||
"name": "配音合成能力",
|
||||
"description": "AI 配音 + 音频混音",
|
||||
"status": "PENDING",
|
||||
"progress": 0,
|
||||
"priority": "MEDIUM",
|
||||
"priority": "medium",
|
||||
"tags": ["AI", "Phase5"]
|
||||
}
|
||||
]
|
||||
@@ -286,7 +288,7 @@ def main():
|
||||
create_task(**task)
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("✅ 数据初始化完成!")
|
||||
print("[OK] 数据初始化完成!")
|
||||
print("=" * 60)
|
||||
print(f"\n访问推进器: http://47.98.113.167:8088/projects")
|
||||
print(f"访问 API 文档: http://47.98.113.167:8089/docs\n")
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
直接写入 tracker.db 的脚本
|
||||
"""
|
||||
import sqlite3
|
||||
from datetime import datetime
|
||||
|
||||
DB_PATH = "tracker.db"
|
||||
|
||||
def init_database():
|
||||
"""初始化所有 Phase 4 和 Phase 6 的任务数据"""
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
cursor = conn.cursor()
|
||||
|
||||
# 清空现有数据
|
||||
cursor.execute("DELETE FROM logs")
|
||||
cursor.execute("DELETE FROM tasks")
|
||||
cursor.execute("DELETE FROM milestones")
|
||||
|
||||
print("=" * 60)
|
||||
print("初始化 xiaoxia-saas 项目数据到 tracker.db")
|
||||
print("=" * 60)
|
||||
|
||||
# ========== Phase 4: SAAS 产品化 ==========
|
||||
print("\n[Phase 4] 初始化任务...")
|
||||
|
||||
# Milestone 1: 认证与账号体系
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("认证与账号体系", "Phase 4", "2026-06-10", "2026-06-17", "completed", "JWT 登录、注册、密码管理"))
|
||||
milestone1_id = cursor.lastrowid
|
||||
|
||||
auth_tasks = [
|
||||
("JWT 工具类实现", "sign/verify/refresh Token 功能", "completed", "high"),
|
||||
("bcrypt 密码哈希工具", "密码加密存储", "completed", "high"),
|
||||
("Redis Session 存储", "refresh_token 存储和管理", "completed", "high"),
|
||||
("邮件服务封装", "SMTP + 邮件模板", "completed", "medium"),
|
||||
("User 实体扩展", "新增 password_hash/email_verified 等字段", "completed", "high"),
|
||||
("注册 API", "邮箱 + 密码注册", "completed", "high"),
|
||||
("登录 API", "JWT 签发 access_token", "completed", "high"),
|
||||
("登出 API", "撤销 refresh_token", "completed", "high"),
|
||||
("刷新 Token API", "用 refresh_token 换取新 access_token", "completed", "high"),
|
||||
("密码重置流程", "忘记密码 + 邮件重置", "completed", "medium"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in auth_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 4", "认证与账号体系", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 2: 多租户权限体系
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("多租户权限体系", "Phase 4", "2026-06-10", "2026-06-17", "completed", "4 种角色、成员管理、邀请系统"))
|
||||
|
||||
permission_tasks = [
|
||||
("WorkspaceMembership 实体", "成员关系实体设计", "completed", "high"),
|
||||
("WorkspaceRole 枚举", "owner/admin/member/viewer", "completed", "high"),
|
||||
("权限检查中间件", "基于角色的访问控制", "completed", "high"),
|
||||
("数据隔离过滤器", "确保跨租户数据隔离", "completed", "high"),
|
||||
("邀请成员 API", "发送邀请邮件", "completed", "high"),
|
||||
("接受/拒绝邀请 API", "处理邀请响应", "completed", "medium"),
|
||||
("移除成员 API", "删除成员关系", "completed", "medium"),
|
||||
("修改成员角色 API", "角色变更", "completed", "medium"),
|
||||
("转让 Workspace 所有权", "转让 owner 角色", "completed", "low"),
|
||||
("权限矩阵验证", "测试所有权限组合", "completed", "high"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in permission_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 4", "多租户权限体系", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 3: 订阅与计费
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("订阅与计费体系", "Phase 4", "2026-06-10", "2026-06-17", "completed", "Free/Pro/Enterprise 套餐"))
|
||||
|
||||
subscription_tasks = [
|
||||
("Subscription 实体与 Repository", "订阅数据模型", "completed", "high"),
|
||||
("SubscriptionPlan 枚举", "free/pro/enterprise", "completed", "high"),
|
||||
("配额检查工具", "检查项目数量、存储限制", "completed", "high"),
|
||||
("套餐限制中间件", "API 调用时检查配额", "completed", "high"),
|
||||
("支付宝 SDK 集成", "支付宝支付接口", "pending", "medium"),
|
||||
("微信支付 SDK 集成", "微信支付接口", "pending", "medium"),
|
||||
("创建支付订单 API", "生成支付订单", "pending", "medium"),
|
||||
("支付回调处理", "处理支付通知", "pending", "medium"),
|
||||
("Invoice 实体与 Repository", "账单数据模型", "completed", "medium"),
|
||||
("生成账单 PDF", "PDF 账单生成", "pending", "low"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in subscription_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 4", "订阅与计费体系", priority, datetime.now().isoformat()))
|
||||
|
||||
print("[OK] Phase 4 任务已录入")
|
||||
|
||||
# ========== Phase 6: 前端完善 ==========
|
||||
print("\n[Phase 6] 初始化任务...")
|
||||
|
||||
# Milestone 1: 基础搭建
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("前端基础搭建", "Phase 6", "2026-06-17", "2026-06-17", "completed", "Vite + React + TypeScript"))
|
||||
|
||||
foundation_tasks = [
|
||||
("项目初始化:Vite + React + TypeScript", "创建 Vite 项目", "completed", "high"),
|
||||
("安装配置依赖包", "Ant Design, React Router 等", "completed", "high"),
|
||||
("搭建基础布局组件", "Header, Sidebar, Footer", "completed", "high"),
|
||||
("API 客户端封装", "Axios 拦截器和 token 管理", "completed", "high"),
|
||||
("路由配置", "React Router 路由定义", "completed", "high"),
|
||||
("设计系统配置", "CSS 变量、色彩系统", "completed", "medium"),
|
||||
("TypeScript 类型定义", "API 响应、实体类型", "completed", "medium"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in foundation_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 6", "前端基础搭建", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 2: 认证页面
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("认证系统", "Phase 6", "2026-06-17", "2026-06-17", "completed", "登录、注册、密码重置"))
|
||||
|
||||
auth_ui_tasks = [
|
||||
("登录页面", "用户登录界面和逻辑", "completed", "high"),
|
||||
("注册页面", "用户注册界面和验证", "completed", "high"),
|
||||
("忘记密码页面", "密码重置请求", "completed", "high"),
|
||||
("重置密码页面", "密码重置界面", "completed", "high"),
|
||||
("Token 管理和刷新", "自动 token 刷新", "completed", "high"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in auth_ui_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 6", "认证系统", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 3: 工作空间管理
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("工作空间管理", "Phase 6", "2026-06-17", "2026-06-17", "completed", "工作空间 CRUD、成员管理"))
|
||||
|
||||
workspace_tasks = [
|
||||
("工作空间列表页面", "显示所有工作空间", "completed", "high"),
|
||||
("工作空间详情页面", "工作空间概览、配额", "completed", "high"),
|
||||
("成员列表和管理", "成员列表、角色修改", "completed", "high"),
|
||||
("邀请成员功能", "邀请成员弹窗", "completed", "high"),
|
||||
("权限矩阵展示", "各角色权限说明", "completed", "medium"),
|
||||
("工作空间设置", "修改名称、删除", "completed", "medium"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in workspace_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 6", "工作空间管理", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 4: 订阅管理
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("订阅管理", "Phase 6", "2026-06-17", "2026-06-17", "completed", "套餐选择、升级流程"))
|
||||
|
||||
subscription_ui_tasks = [
|
||||
("套餐选择页面", "Free/Pro/Enterprise 对比", "completed", "high"),
|
||||
("升级流程", "订阅升级流程和确认", "completed", "high"),
|
||||
("配额展示组件", "项目数量、存储使用", "completed", "high"),
|
||||
("账单页面", "历史账单列表", "completed", "medium"),
|
||||
("发票申请入口", "发票申请表单", "completed", "low"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in subscription_ui_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 6", "订阅管理", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 5: Admin 后台
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("Admin 后台", "Phase 6", "2026-06-17", "2026-06-17", "completed", "Dashboard、用户管理"))
|
||||
|
||||
admin_tasks = [
|
||||
("Dashboard 仪表盘", "关键指标和图表", "completed", "high"),
|
||||
("用户管理页面", "用户列表、搜索", "completed", "high"),
|
||||
("用户操作功能", "封禁、解封、重置密码", "completed", "high"),
|
||||
("系统监控页面", "API 性能、数据库状态", "completed", "medium"),
|
||||
("日志查看器", "错误日志和慢查询", "completed", "medium"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in admin_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 6", "Admin 后台", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 6: 个人中心
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("个人中心", "Phase 6", "2026-06-17", "2026-06-17", "completed", "个人设置、安全设置"))
|
||||
|
||||
profile_tasks = [
|
||||
("个人设置页面", "基本信息、头像上传", "completed", "medium"),
|
||||
("账号安全设置", "修改密码、修改邮箱", "completed", "high"),
|
||||
("通知设置", "邮件通知、类型选择", "completed", "medium"),
|
||||
("Session 管理", "设备列表、登出设备", "completed", "medium"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in profile_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 6", "个人中心", priority, datetime.now().isoformat()))
|
||||
|
||||
# Milestone 7: 测试与优化
|
||||
cursor.execute("""
|
||||
INSERT INTO milestones (name, phase, start_date, end_date, status, description)
|
||||
VALUES (?, ?, ?, ?, ?, ?)
|
||||
""", ("测试与优化", "Phase 6", "2026-06-17", "2026-06-17", "completed", "单元测试、E2E 测试、性能优化"))
|
||||
|
||||
test_tasks = [
|
||||
("单元测试", "Vitest + React Testing Library", "completed", "high"),
|
||||
("E2E 测试:认证流程", "Playwright 自动化测试", "completed", "high"),
|
||||
("E2E 测试:工作空间", "工作空间管理流程测试", "completed", "high"),
|
||||
("E2E 测试:订阅管理", "订阅升级流程测试", "completed", "medium"),
|
||||
("性能优化:代码分割", "Vendor chunks 分割", "completed", "high"),
|
||||
("性能优化:图片和资源", "压缩和懒加载", "completed", "medium"),
|
||||
("可访问性优化", "WCAG 2.1 AA 标准", "completed", "medium"),
|
||||
("移动端适配优化", "响应式设计验证", "completed", "medium"),
|
||||
]
|
||||
|
||||
for name, desc, status, priority in test_tasks:
|
||||
cursor.execute("""
|
||||
INSERT INTO tasks (name, description, status, phase, milestone, priority, created_at)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
""", (name, desc, status, "Phase 6", "测试与优化", priority, datetime.now().isoformat()))
|
||||
|
||||
print("[OK] Phase 6 任务已录入")
|
||||
|
||||
conn.commit()
|
||||
|
||||
# 统计
|
||||
cursor.execute("SELECT COUNT(*) FROM milestones")
|
||||
milestone_count = cursor.fetchone()[0]
|
||||
|
||||
cursor.execute("SELECT COUNT(*) FROM tasks")
|
||||
task_count = cursor.fetchone()[0]
|
||||
|
||||
cursor.execute("SELECT phase, COUNT(*) FROM tasks GROUP BY phase")
|
||||
phase_stats = cursor.fetchall()
|
||||
|
||||
conn.close()
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("[SUCCESS] 数据初始化完成!")
|
||||
print("=" * 60)
|
||||
print(f"✅ 里程碑总数: {milestone_count}")
|
||||
print(f"✅ 任务总数: {task_count}")
|
||||
print("\n各 Phase 任务统计:")
|
||||
for phase, count in phase_stats:
|
||||
print(f" - {phase}: {count} 个任务")
|
||||
print("\n推进器地址: http://47.98.113.167:8088/projects")
|
||||
print("=" * 60)
|
||||
|
||||
if __name__ == "__main__":
|
||||
init_database()
|
||||
Reference in New Issue
Block a user