market-flow.md 2.9 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[获取公开模板列表 /packages]
        A2 --> A3[获取模板详情 /packages/{id}]
        A3 --> A4[获取任务项 /packages/{id}/items]
        A4 --> A5[通过分享码获取 /share/{code}]
    end

    subgraph 购买流程
        A5 --> B1[获取模板价格 /price]
        B1 --> B2[获取可用指导师 /available-guides]
        B2 --> B3[创建订单 /order/create]
        B3 --> B4[获取微信支付参数 /wechat params]
        B4 --> B5[微信支付回调 /notify]
        B5 --> B6[支付成功后应用 /apply]
        B6 --> B7[购买并应用模板 /packages/{id}/purchase]
    end

    subgraph 我的计划
        B7 --> C1[获取我的计划 /plans]
        C1 --> C2[获取计划详情 /plans/{id}]
        C2 --> C3[获取计划任务项 /plans/{id}/items]
        C3 --> C4[取消计划 /plans/{id}/cancel]
    end

    subgraph 模板创建(管理员/规划师)
        A2 --> D1[创建模板 /create]
        D1 --> D2[更新模板 /{id}/update]
        D2 --> D3[添加任务项 /{id}/items]
        D3 --> D4[提交审核 /{id}/submit]
        D4 --> D5[审核通过后发布 /{id}/publish]
    end

    R1(("👤 家长")):::actor
    R2(("📋 规划师/管理员")):::role
    R3(("💳 微信支付")):::system

    A1 -.- R1
    D1 -.- R2
    B5 -.- R3

端点明细

端点 说明
/api/market/packages 获取公开模板列表
/api/market/packages/{id} 获取模板详情
/api/market/packages/{id}/items 获取任务项
/api/market/share/{code} 通过分享码获取
/api/market/packages/{id}/purchase 购买并应用
/api/market/plans 获取我的计划
/api/market/plans/{id} 计划详情
/api/market/plans/{id}/items 计划任务项
/api/market/plans/{id}/cancel 取消计划
/api/package/price 模板价格
/api/package/available-guides 可用指导师
/api/package/order/create 创建订单
/api/package/order/{orderNo} 订单详情
/api/payment/create 创建支付订单
/api/payment/wechat params 微信支付参数
/api/payment/notify 支付回调
/api/payment/apply 应用模板
/api/packages/create 创建模板
/api/packages/{id}/update 更新模板
/api/packages/{id}/submit 提交审核
/api/packages/{id}/publish 发布/下架