Commit 0bd83d36 authored by qinhaitao's avatar qinhaitao

fix: 🐛 卡片状态错误

parent c2a53dd4
......@@ -16,7 +16,7 @@ export default function preCheck(checks: IFunction[]) {
for (let i = 0; i < checks.length; i++) {
const checkFn = checks[i]
let result = await checkFn.apply(target, [context, { ...otherArgs }, services, preCheckData])
let result = await checkFn(context, { ...otherArgs }, services, preCheckData)
result = result || {}
// 校验报错
if ((result as IErrorResult)?.success === false && (result as IErrorResult)?.code) {
......
......@@ -145,12 +145,12 @@ export default class CardService extends UserService {
prizeDataType
},
{
projection: { type: 1, image: 1, prizeDataType: 1, name: 1 }
projection: { type: 1, image: 1, prizeDataType: 1, name: 1, [needKey]: 1 }
}
)
// 抽奖次数奖池分类 从小到大排列
const category = uniq(joinedTimesPrizePool.map(v => +v[needKey])).sort()
const category = uniq(joinedTimesPrizePool.map(v => +v[needKey])).sort((a, b) => a - b)
const prizeMapper = category.reduce((prev, curr) => {
return {
......
......@@ -5,9 +5,9 @@ import { CARD_PRIZE_STATUS } from '../../constants'
export function setCardPrizeStatus(joinedTimes: number, needTimes: number, joinedTimesAwardList: IAwards[]) {
if (joinedTimes < needTimes) return CARD_PRIZE_STATUS.LOCK
if (needTimes >= joinedTimes && !joinedTimesAwardList.some(v => v.needTimes === needTimes))
if (joinedTimes >= needTimes && !joinedTimesAwardList.some(v => v.needTimes === needTimes))
return CARD_PRIZE_STATUS.UN_LOCK
if (needTimes >= joinedTimes && joinedTimesAwardList.some(v => v.needTimes === needTimes))
if (joinedTimes >= needTimes && joinedTimesAwardList.some(v => v.needTimes === needTimes))
return CARD_PRIZE_STATUS.SUCCESS
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment