Game Power-Ups Mock API
源码:
web/src/mock/modules/game/powerups.ts
接口列表
| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /api/v1/games/:gameId/power-ups/:type/use | 使用道具 |
| POST | /api/v1/games/:gameId/power-ups/:type/add | 添加道具 |
请求参数
POST /api/v1/games/:gameId/power-ups/:type/use
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| gameId | 路径 | string | 游戏ID |
| type | 路径 | string | 道具类型(hammer / shuffle / hint) |
POST /api/v1/games/:gameId/power-ups/:type/add
| 参数 | 位置 | 类型 | 说明 |
|---|---|---|---|
| gameId | 路径 | string | 游戏ID |
| type | 路径 | string | 道具类型 |
| amount | body | number | 添加数量(默认 1) |
道具初始值
| 游戏 | hammer | shuffle | hint |
|---|---|---|---|
| pictograph_match | - | - | 1 |
| stroke_puzzle | - | - | 1 |
| char_match3 | 3 | 2 | 3 |
响应格式
POST /api/v1/games/:gameId/power-ups/:type/use
成功:
json
{ "code": 0, "msg": "ok", "data": { "type": "hint", "remaining": 2 } }错误(道具不足):
json
{ "code": 400, "msg": "道具不足", "data": null }POST /api/v1/games/:gameId/power-ups/:type/add
json
{ "code": 0, "msg": "ok", "data": { "type": "hint", "total": 4 } }被哪个 Store 调用
- GameStore (
web/src/stores/game.ts)usePowerUp(gameId, type)→POST /api/v1/games/:gameId/power-ups/:type/useaddPowerUp(gameId, type, amount)→POST /api/v1/games/:gameId/power-ups/:type/add