feat(游戏): 添加对对碰游戏相关接口

添加开始游戏、执行配对、获取游戏状态和获取卡牌配置的接口
This commit is contained in:
邹方成 2025-12-19 09:17:43 +08:00
parent d930756130
commit 54ce24b7b8
2 changed files with 964 additions and 536 deletions

View File

@ -174,3 +174,37 @@ export function getInviteRecords(page = 1, page_size = 20) {
const user_id = uni.getStorageSync('user_id')
return getUserInvites(user_id, page, page_size)
}
// ============================================
// 对对碰游戏 (Matching Game) 接口
// ============================================
/**
* 开始游戏
* @param {number} issue_id - 对应的活动期次ID
*/
export function startMatchingGame(issue_id) {
return authRequest({ url: '/api/app/matching/start', method: 'POST', data: { issue_id } })
}
/**
* 执行配对 (下一轮)
* @param {string} game_id - start接口返回的游戏ID
*/
export function playMatchingGame(game_id) {
return authRequest({ url: '/api/app/matching/play', method: 'POST', data: { game_id } })
}
/**
* 获取游戏状态 (用于重连)
* @param {string} game_id - 游戏ID
*/
export function getMatchingGameState(game_id) {
return authRequest({ url: '/api/app/matching/state', method: 'GET', data: { game_id } })
}
/**
* 获取所有启用的卡牌配置
*/
export function getMatchingCardTypes() {
return authRequest({ url: '/api/app/matching/card_types', method: 'GET' })
}

File diff suppressed because it is too large Load Diff