minigame-flow.md 2.3 KB

用户使用流程图 — 小游戏

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[获取游戏详情 /{gameCode}]
    end

    subgraph 游戏执行
        A3 --> B1{游戏类型}
        B1 -->|舒尔特方格| B2[完成专注力训练]
        B1 -->|猜数字| B3[完成逻辑训练]
        B1 -->|数独| B4[完成思维训练]
        B2 --> B5[游戏完成 /complete]
        B3 --> B5
        B4 --> B5
    end

    subgraph 游戏记录
        B5 --> C1[保存游戏记录 /game/record]
        C1 --> C2[获取游戏历史 /game/history]
        C2 --> C3[获取最佳成绩 /game/best]
        C3 --> C4[获取统计概览 /game/stats]
        C4 --> C5[获取排行榜 /game/leaderboard]
    end

    subgraph 管理端
        A2 --> D1[获取所有游戏 /all]
        D1 --> D2[更新游戏状态 /{id}/status]
    end

    subgraph 智慧数学
        A1 --> E1[开始答题 /api/wisdom/math/start]
        E1 --> E2[验证答案 /api/wisdom/math/verify]
        E2 --> E3[完成游戏 /api/wisdom/math/complete]
    end

    R1(("👶 孩子")):::actor
    R2(("🎮 游戏引擎")):::system

    A1 -.- R1
    C5 -.- R2

端点明细

端点 说明
/api/mini-game/list 小游戏列表
/api/mini-game/{gameCode} 游戏详情
/api/mini-game/all 所有游戏(管理端)
/api/mini-game/{id}/status 更新游戏状态
/api/mini-game/complete 完成游戏
/api/game/record 保存游戏记录
/api/game/history 游戏历史
/api/game/best 最佳成绩
/api/game/stats 统计概览
/api/game/leaderboard 排行榜
/api/wisdom/math/start 开始数学游戏
/api/wisdom/math/verify 验证答案
/api/wisdom/math/complete 完成游戏