修正获取券列表报错的bug
This commit is contained in:
parent
8050ce9e23
commit
f411255443
@ -75,6 +75,7 @@
|
|||||||
| answer | 回答的选项 |
|
| answer | 回答的选项 |
|
||||||
| type | 回答类型, 0: 正常, 1: 超时 |
|
| type | 回答类型, 0: 正常, 1: 超时 |
|
||||||
| mode | 游戏类型, 0: 单人, 1: 多人 |
|
| mode | 游戏类型, 0: 单人, 1: 多人 |
|
||||||
|
| debug | 多人模式时, 如果该字段有值, 则直接进入下一轮 |
|
||||||
|
|
||||||
3. Response: JSON
|
3. Response: JSON
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ class GameUserController extends BaseController {
|
|||||||
@router('post /api/:accountid/tickets')
|
@router('post /api/:accountid/tickets')
|
||||||
async userTickets(req: any) {
|
async userTickets(req: any) {
|
||||||
const { accountid, sid } = req.params
|
const { accountid, sid } = req.params
|
||||||
return await UserReward.ticketList( accountid, sid )
|
const result = await UserReward.ticketList( accountid, sid )
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import { Shop } from './shop/Shop'
|
|||||||
import { Coupon } from './shop/Coupon'
|
import { Coupon } from './shop/Coupon'
|
||||||
import { getCouponUrl } from '../services/File'
|
import { getCouponUrl } from '../services/File'
|
||||||
import { PuzzleSessionClass } from './match/PuzzleSession'
|
import { PuzzleSessionClass } from './match/PuzzleSession'
|
||||||
|
import { isObjectId } from '../utils/string.util'
|
||||||
|
|
||||||
const nanoid = customAlphabet('2345678abcdefghjkmnpqrstwxy', 10)
|
const nanoid = customAlphabet('2345678abcdefghjkmnpqrstwxy', 10)
|
||||||
|
|
||||||
@ -76,12 +77,18 @@ class UserRewardClass extends BaseModule {
|
|||||||
|
|
||||||
public static async ticketList(accountId: string, shopId?: string) {
|
public static async ticketList(accountId: string, shopId?: string) {
|
||||||
let params:any = { accountId }
|
let params:any = { accountId }
|
||||||
|
let shopMap: Map<string, string> = new Map()
|
||||||
if (shopId) {
|
if (shopId) {
|
||||||
|
if (!isObjectId(shopId)) {
|
||||||
|
let shopData = await Shop.fetchByID(shopId)
|
||||||
|
shopId = shopData.id
|
||||||
|
shopMap.set(shopId, shopData.showName)
|
||||||
|
}
|
||||||
params.shop = shopId
|
params.shop = shopId
|
||||||
}
|
}
|
||||||
let records = await UserReward.find(params)
|
let records = await UserReward.find(params)
|
||||||
let results: any = []
|
let results: any = []
|
||||||
let shopMap: Map<string, string> = new Map()
|
|
||||||
let couponMap : Map<string, any> = new Map()
|
let couponMap : Map<string, any> = new Map()
|
||||||
for (let record of records) {
|
for (let record of records) {
|
||||||
let sid = record.shop
|
let sid = record.shop
|
||||||
@ -104,6 +111,7 @@ class UserRewardClass extends BaseModule {
|
|||||||
status: record.status
|
status: record.status
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
return results
|
||||||
}
|
}
|
||||||
|
|
||||||
public compactInfo() {
|
public compactInfo() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user