# 用户使用流程图 — 任务管理 ```mermaid flowchart TD %% ============ 颜色定义 ============ classDef actor fill:#e1f5fe,stroke:#0288d1,stroke-width:2px classDef action fill:#fff3e0,stroke:#f57c00,stroke-width:1px classDef system fill:#e8f5e9,stroke:#388e3c,stroke-width:1px classDef decision fill:#fce4ec,stroke:#d32f2f,stroke-width:1px classDef role fill:#f3e5f5,stroke:#7b1fa2,stroke-width:1px classDef endpoint fill:#f5f5f5,stroke:#616161,stroke-width:1px,shape:box subgraph 任务创建 A1(("家长/规划师")) --> A2{创建来源} A2 -->|手动创建| A3[创建任务 /create] A2 -->|从模板| A4[市场购买模板 → 应用] A2 -->|AI推荐| A5[AI生成任务建议 → 一键添加] A2 -->|训练方案| A6[训练方案下发 /deploy] A3 --> A7[获取可选小游戏 /minigame-options] end subgraph 任务执行 A7 --> B1[获取今日任务 /today] B1 --> B2{任务类型} B2 -->|普通任务| B3[完成任务 /{id}/complete] B2 -->|小游戏| B4[完成小游戏 /{id}/complete-minigame] B2 -->|家长任务| B5[家长完成任务 /{id}/complete-parent] B3 --> B6{需要审核?} B6 -->|是| B7[进入待审核 /pending-review] B6 -->|否| B8[任务完成] B4 --> B8 B5 --> B8 end subgraph 任务审核 B7 --> C1[获取待审核列表 /pending-review] C1 --> C2[审核任务 /{id}/review] C2 --> C3{审核结果} C3 -->|通过| C4[任务完成 发放能量] C3 -->|驳回| C5[任务退回] end subgraph 规划师批量管理 A1 --> D1[获取关联家庭 /bound-families] D1 --> D2[获取家庭任务概览 /{familyId}/overview] D2 --> D3[获取孩子任务 /{familyId}/children/{childId}/tasks] D3 --> D4[批量审核 /batch-review] D4 --> D5[修改任务 /{taskId}] D5 --> D6[删除任务 /{taskId}/delete] end subgraph 任务历史与统计 B8 --> E1[获取任务历史 /history] E1 --> E2[批量完成任务 /batch-complete] E2 --> E3[批量删除任务 /batch-delete] end R1(("👤 家长/规划师")):::actor R2(("👶 孩子")):::actor R3(("📋 规划师")):::role A1 -.- R1 B3 -.- R2 D1 -.- R3 ``` ## 端点明细 | 端点 | 说明 | |------|------| | `/api/tasks/create` | 创建任务 | | `/api/tasks/today` | 获取今日任务 | | `/api/tasks/{id}/complete` | 完成任务 | | `/api/tasks/{id}/review` | 审核任务 | | `/api/tasks/history` | 获取任务历史 | | `/api/tasks/pending-review` | 获取待审核任务 | | `/api/tasks/today-parent` | 获取家长今日任务 | | `/api/tasks/{id}/complete-parent` | 家长完成任务 | | `/api/tasks/{id}/complete-minigame` | 完成小游戏任务 | | `/api/tasks/batch-complete` | 批量完成任务 | | `/api/tasks/batch-delete` | 批量删除任务 | | `/api/tasks/minigame-options` | 获取可选小游戏 | | `/api/guide/families/bound-families` | 获取关联家庭 | | `/api/guide/families/{familyId}/overview` | 家庭任务概览 | | `/api/guide/families/{familyId}/children/{childId}/tasks` | 孩子任务列表 | | `/api/guide/families/{familyId}/children/{childId}/pending-review` | 待审核列表 | | `/api/guide/families/{familyId}/tasks/{taskId}/review` | 审核任务 | | `/api/guide/families/{familyId}/tasks/batch-review` | 批量审核 | | `/api/guide/families/{familyId}/tasks/{taskId}/delete` | 删除任务 | | `/api/guide/families/dashboard-stats` | 规划师首页统计 |