diff --git a/doc/api.md b/doc/api.md index 19eaff9..53e97a8 100644 --- a/doc/api.md +++ b/doc/api.md @@ -75,6 +75,7 @@ | answer | 回答的选项 | | type | 回答类型, 0: 正常, 1: 超时 | | mode | 游戏类型, 0: 单人, 1: 多人 | +| debug | 多人模式时, 如果该字段有值, 则直接进入下一轮 | 3. Response: JSON diff --git a/src/api/controllers/game_user.controller.ts b/src/api/controllers/game_user.controller.ts index 0b72207..b809cd8 100644 --- a/src/api/controllers/game_user.controller.ts +++ b/src/api/controllers/game_user.controller.ts @@ -49,7 +49,8 @@ class GameUserController extends BaseController { @router('post /api/:accountid/tickets') async userTickets(req: any) { const { accountid, sid } = req.params - return await UserReward.ticketList( accountid, sid ) + const result = await UserReward.ticketList( accountid, sid ) + return result } } diff --git a/src/models/UserReward.ts b/src/models/UserReward.ts index ccc4498..2456805 100644 --- a/src/models/UserReward.ts +++ b/src/models/UserReward.ts @@ -11,6 +11,7 @@ import { Shop } from './shop/Shop' import { Coupon } from './shop/Coupon' import { getCouponUrl } from '../services/File' import { PuzzleSessionClass } from './match/PuzzleSession' +import { isObjectId } from '../utils/string.util' const nanoid = customAlphabet('2345678abcdefghjkmnpqrstwxy', 10) @@ -76,12 +77,18 @@ class UserRewardClass extends BaseModule { public static async ticketList(accountId: string, shopId?: string) { let params:any = { accountId } + let shopMap: Map = new Map() if (shopId) { + if (!isObjectId(shopId)) { + let shopData = await Shop.fetchByID(shopId) + shopId = shopData.id + shopMap.set(shopId, shopData.showName) + } params.shop = shopId } let records = await UserReward.find(params) let results: any = [] - let shopMap: Map = new Map() + let couponMap : Map = new Map() for (let record of records) { let sid = record.shop @@ -104,6 +111,7 @@ class UserRewardClass extends BaseModule { status: record.status }) } + return results } public compactInfo() {