fix: 质押占领矿洞占比

This commit is contained in:
lianghuanjie
2025-01-09 16:33:25 +08:00
parent 6acad51ebd
commit 84d23a295d
2 changed files with 7 additions and 2 deletions

View File

@@ -101,7 +101,12 @@ func (l *StakeSettleLogic) StakeSettle() {
}
tokensDecimal := decimal.NewFromFloat(tokens)
reward := tokensDecimal.Mul(decimal.NewFromFloat(coefficient))
err = l.svcCtx.StakeRewardModel.SetReward(l.ctx, uid, awardSeq, taskConf.OccupyPercent, tokensDecimal, reward)
var gameBonus int
if l.svcCtx.GamePitModel.UserExist(l.ctx, uid) {
gameBonus = taskConf.OccupyPercent
reward = reward.Mul(decimal.NewFromFloat(float64(100+gameBonus) / 100))
}
err = l.svcCtx.StakeRewardModel.SetReward(l.ctx, uid, awardSeq, gameBonus, tokensDecimal, reward)
if err != nil {
logx.Errorw("set reward failed", logx.Field("err", err), logx.Field("uid", uid), logx.Field("awardSeq", awardSeq), logx.Field("coefficient", coefficient), logx.Field("tokens", tokens), logx.Field("reward", reward))
continue