nft task reward
This commit is contained in:
@@ -3,6 +3,7 @@ package task
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"github.com/spf13/cast"
|
||||
"nova_task/internal/model"
|
||||
"nova_task/internal/pkg/errs"
|
||||
"nova_task/internal/pkg/utils"
|
||||
@@ -76,6 +77,15 @@ func (l *GetStakeTaskDetailLogic) GetStakeTaskDetail() (*types.StakeTaskDetail,
|
||||
canReceiveTokens = produceTokensToday
|
||||
}
|
||||
|
||||
awardSeq := cast.ToInt(time.Now().Format("20060102"))
|
||||
coefficient, err := l.svcCtx.StakeRewardModel.GetRandomCoefficientByUid(l.ctx, uid, awardSeq, taskConf.MinCoefficient, taskConf.MaxCoefficient)
|
||||
if err != nil {
|
||||
l.Errorw("get random coefficient failed", logx.Field("err", err), logx.Field("uid", uid), logx.Field("awardSeq", awardSeq))
|
||||
return nil, errs.New(errs.ErrDatabaseOperate, err)
|
||||
}
|
||||
|
||||
canReceiveTokens *= coefficient
|
||||
|
||||
return &types.StakeTaskDetail{
|
||||
StartDate: start.Format(time.DateOnly),
|
||||
EndDate: end.Format(time.DateOnly),
|
||||
|
||||
Reference in New Issue
Block a user