From 6abd7cfcf20dfb6ce214640d34c6c094637a7107 Mon Sep 17 00:00:00 2001 From: zhl Date: Fri, 21 May 2021 12:40:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=8C=91=E6=88=98=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E8=BF=94=E5=9B=9E=E5=BC=82=E5=B8=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/controllers/exam.controller.ts | 5 ++--- src/models/UserReward.ts | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/api/controllers/exam.controller.ts b/src/api/controllers/exam.controller.ts index ff67e57..0416eea 100644 --- a/src/api/controllers/exam.controller.ts +++ b/src/api/controllers/exam.controller.ts @@ -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 } } diff --git a/src/models/UserReward.ts b/src/models/UserReward.ts index 27a8d4d..bcdaae4 100644 --- a/src/models/UserReward.ts +++ b/src/models/UserReward.ts @@ -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)