minigame-flow.md 3.2 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
    classDef portMiniApp fill:#e3f2fd,stroke:#1565c0,stroke-width:1px,stroke-dasharray:3 2
    classDef portAdmin fill:#fce4ec,stroke:#c62828,stroke-width:1px,stroke-dasharray:3 2
    classDef portGuide fill:#fff8e1,stroke:#f57f17,stroke-width:1px,stroke-dasharray:3 2
    classDef portSystem fill:#f3e5f5,stroke:#6a1b9a,stroke-width:1px,stroke-dasharray:3 2

    subgraph 游戏浏览
        A1(("👶 孩子")):::portMiniApp --> A2[📱 获取小游戏列表 /list]:::portMiniApp
        A2 --> A3[📱 获取游戏详情 /:gameCode]:::portMiniApp
    end

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

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

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

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

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

    A1 -.- R1
    C5 -.- R2

端点明细

端点 说明 端口
/api/mini-game/list 小游戏列表 📱小程序
/api/mini-game/{gameCode} 游戏详情 📱小程序
/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 完成游戏 📱小程序
/api/mini-game/all 所有游戏 🖥管理后台
/api/mini-game/{id}/status 更新游戏状态 🖥管理后台