nft质押道具发放
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"github.com/shopspring/decimal"
|
||||
"github.com/spf13/cast"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"nova_task/internal/model"
|
||||
"nova_task/internal/pkg/utils"
|
||||
"nova_task/internal/svc"
|
||||
"time"
|
||||
@@ -28,6 +29,7 @@ func (c *Cron) Spec() string {
|
||||
}
|
||||
|
||||
func (c *Cron) Run() {
|
||||
logx.Debugw("run settle cron task")
|
||||
start, end, err := c.svcCtx.ConfigModel.GetNftStakeTaskOpenDate(c.ctx)
|
||||
if err != nil {
|
||||
logx.Errorw("get nft stake task open date failed", logx.Field("err", err))
|
||||
@@ -95,9 +97,24 @@ func (c *Cron) Run() {
|
||||
continue
|
||||
}
|
||||
|
||||
// todo: 增加资产
|
||||
//c.svcCtx.TaskAssetModel.AddUserPoint()
|
||||
// 加资产
|
||||
err = c.svcCtx.TaskAssetModel.AddCastile(c.ctx, uid, reward)
|
||||
if err != nil {
|
||||
logx.Errorw("add castile failed", logx.Field("err", err), logx.Field("uid", uid), logx.Field("awardSeq", awardSeq), logx.Field("reward", reward))
|
||||
continue
|
||||
}
|
||||
// 加资产记录表
|
||||
_, err = c.svcCtx.TaskAssetRecordModel.Insert(c.ctx, &model.NhTaskAssetRecord{
|
||||
Uid: int(uid),
|
||||
EventId: 0,
|
||||
AssetField: "castile",
|
||||
Count: reward.InexactFloat64(),
|
||||
Remark: "nft软质押奖励",
|
||||
ProvideUid: 0,
|
||||
CreateTime: int(now.Unix()),
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorw("insert task asset record failed", logx.Field("err", err), logx.Field("uid", uid), logx.Field("awardSeq", awardSeq), logx.Field("reward", reward))
|
||||
}
|
||||
}
|
||||
|
||||
logx.Debugw("run settle cron task")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user