diff --git a/src/controllers/chest.controller.ts b/src/controllers/chest.controller.ts index cd2ed27..d9a8666 100644 --- a/src/controllers/chest.controller.ts +++ b/src/controllers/chest.controller.ts @@ -251,10 +251,14 @@ class BoxController extends BaseController { throw new ZError(16, 'user enhance times exceed') } const score = chest.bounsCfg[chest.bonusUsers.length] || chest.bounsCfg[chest.bounsCfg.length - 1] + let scoreTotal = 0 + for (let i = 0, l = Math.min(chest.bonusUsers.length, chest.bounsCfg.length - 1); i <= l; i++) { + scoreTotal += chest.bounsCfg[i] + } let doc = await ActivityChest.findOneAndUpdate( { _id: chest.id }, { - $inc: { scoreBonus: score }, + scoreBonus: scoreTotal, $push: { bonusUsers: uid }, }, )