优化助力逻辑
This commit is contained in:
parent
fe75d261d5
commit
68e679cdd2
@ -251,10 +251,14 @@ class BoxController extends BaseController {
|
|||||||
throw new ZError(16, 'user enhance times exceed')
|
throw new ZError(16, 'user enhance times exceed')
|
||||||
}
|
}
|
||||||
const score = chest.bounsCfg[chest.bonusUsers.length] || chest.bounsCfg[chest.bounsCfg.length - 1]
|
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(
|
let doc = await ActivityChest.findOneAndUpdate(
|
||||||
{ _id: chest.id },
|
{ _id: chest.id },
|
||||||
{
|
{
|
||||||
$inc: { scoreBonus: score },
|
scoreBonus: scoreTotal,
|
||||||
$push: { bonusUsers: uid },
|
$push: { bonusUsers: uid },
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user