From 54ce24b7b816c9ed6a2310406d26396f4975c5c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=96=B9=E6=88=90?= Date: Fri, 19 Dec 2025 09:17:43 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=B8=B8=E6=88=8F):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=AF=B9=E5=AF=B9=E7=A2=B0=E6=B8=B8=E6=88=8F=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加开始游戏、执行配对、获取游戏状态和获取卡牌配置的接口 --- api/appUser.js | 34 + pages/activity/duiduipeng/index.vue | 1466 +++++++++++++++++---------- 2 files changed, 964 insertions(+), 536 deletions(-) diff --git a/api/appUser.js b/api/appUser.js index 0c30ab2..bbfb30b 100644 --- a/api/appUser.js +++ b/api/appUser.js @@ -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' }) +} diff --git a/pages/activity/duiduipeng/index.vue b/pages/activity/duiduipeng/index.vue index 1294afc..2e2f18b 100644 --- a/pages/activity/duiduipeng/index.vue +++ b/pages/activity/duiduipeng/index.vue @@ -1,656 +1,1050 @@