修正挑战奖励返回异常的bug

This commit is contained in:
zhl 2021-05-21 12:40:48 +08:00
parent 1f898928de
commit 6abd7cfcf2
2 changed files with 4 additions and 3 deletions

View File

@ -149,7 +149,7 @@ class ExamController extends BaseController {
rspData.rankTotal = rankTotal
let examData = await ShopExam.findById(history.activityId)
let rewardList = []
if (!examData && examData.rewardInfo && examData.rewardInfo.length > 0) {
if (examData && examData.rewardInfo && examData.rewardInfo.length > 0) {
let rewards = examData.getReward(statMap.score)
for (let reward of rewards) {
let geted = await UserReward.examRewardGeted(history, accountid, reward.id)
@ -160,10 +160,9 @@ class ExamController extends BaseController {
rewardList.push(data)
}
}
rspData.rewords = rewardList
rspData.rewards = rewardList
}
rspData.gameResult = gameResult
rspData.rewords = {}
return rspData
}
}

View File

@ -135,6 +135,8 @@ class UserRewardClass extends BaseModule {
})
if (history.type === 1) {
record.activityId = history.activityId
} else if (history.type === 2) {
record.examId = history.activityId
}
await record.save()
ids.push(record.sid)