# 用户使用流程图 — 勋章与微行动 ```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[获取启用的勋章列表 /list] A2 --> A3[获取勋章详情 /detail] A3 --> A4[收藏/取消收藏 /favorite] end subgraph 勋章获得 A4 --> B1[获取孩子勋章列表 /child/list] B1 --> B2[孩子勋章统计 /statistics/child] B2 --> B3[家庭勋章排行 /ranking/family] end subgraph 管理员授勋 B3 --> C1[获取所有勋章 /all] C1 --> C2[创建勋章 /create] C2 --> C3[更新勋章 /update] C3 --> C4[删除勋章 /delete] C4 --> C5[手动授予勋章 /grant] end subgraph 微行动 A1 --> D1[获取所有微行动列表 /micro-action/list] D1 --> D2[获取今日推荐 /micro-action/today] D2 --> D3[完成微行动 /micro-action/complete] D3 --> D4[检查今日完成 /micro-action/check-today] end R1(("👤 用户")):::actor R2(("🔧 管理员")):::role A1 -.- R1 C1 -.- R2 ``` ## 端点明细 | 端点 | 说明 | |------|------| | `/api/badges/list` | 启用的勋章列表 | | `/api/badges/all` | 所有勋章(管理端) | | `/api/badges/detail` | 勋章详情 | | `/api/badges/create` | 创建勋章 | | `/api/badges/update` | 更新勋章 | | `/api/badges/delete` | 删除勋章 | | `/api/badges/grant` | 手动授予勋章 | | `/api/badges/child/list` | 孩子勋章列表 | | `/api/badges/favorite` | 收藏/取消 | | `/api/badges/statistics/child` | 孩子勋章统计 | | `/api/badges/ranking/family` | 家庭勋章排行 | | `/api/micro-action/list` | 微行动列表 | | `/api/micro-action/today` | 今日推荐 | | `/api/micro-action/complete` | 完成微行动 | | `/api/micro-action/check-today` | 检查今日完成 |