Skip to content

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道具类型
amountbodynumber添加数量(默认 1)

道具初始值

游戏hammershufflehint
pictograph_match--1
stroke_puzzle--1
char_match3323

响应格式

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/use
    • addPowerUp(gameId, type, amount)POST /api/v1/games/:gameId/power-ups/:type/add