抽卡:修改引导抽卡逻辑

This commit is contained in:
luying
2021-12-04 10:11:13 +08:00
parent 5bd6eb573c
commit 7db22ba677
2 changed files with 6 additions and 3 deletions
@@ -403,15 +403,16 @@ export class GachaHandler {
const gachaId = GACHA_ID.NORMAL; const gachaId = GACHA_ID.NORMAL;
let userGacha = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL); let userGacha = await UserGachaModel.findByRole(roleId, GACHA_ID.NORMAL);
let { guideResultList, candidates = [] } = userGacha; let { guideResultList, candidates = [], guideCount } = userGacha;
let index = candidates.findIndex(cur => cur.id == id); let index = candidates.findIndex(cur => cur.id == id);
if(index == -1) { if(index == -1) {
candidates.push({ candidates.push({
id, list: guideResultList id, guideCount, list: guideResultList
}); });
} else { } else {
candidates[index].list = guideResultList; candidates[index].list = guideResultList;
candidates[index].guideCount = guideCount;
} }
userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { candidates }) userGacha = await UserGachaModel.updateInfo(roleId, gachaId, 0, { candidates })
+2
View File
@@ -50,6 +50,8 @@ class SimpleResult {
class Candidate { class Candidate {
@prop({ required: true }) @prop({ required: true })
id: number; // 列表id id: number; // 列表id
@prop({ required: true })
guideCount: number; // 引导次数
@prop({ required: true, type: SimpleResult, _id: false }) @prop({ required: true, type: SimpleResult, _id: false })
list: SimpleResult[]; // 是否得到 list: SimpleResult[]; // 是否得到
} }