nft质押任务逻辑

This commit is contained in:
lianghuanjie
2024-12-27 18:06:13 +08:00
parent a22f73df20
commit 31a674080d
39 changed files with 1532 additions and 99 deletions

View File

@@ -18,8 +18,11 @@ const (
ErrGenerateToken Reason = 1005 // 生成token错误
// ======= 业务层错误20000~29999 =======
ErrUnknownLogicError Reason = 20000 // 未知的业务错误
ErrTaskNotFound Reason = 20001 // 任务不存在
ErrTaskAlreadyReward Reason = 20002 // 任务已领取
ErrTaskNotFinished Reason = 20003 // 任务未完成
ErrUnknownLogicError Reason = 20000 // 未知的业务错误
ErrTaskNotFound Reason = 20001 // 任务不存在
ErrTaskAlreadyReward Reason = 20002 // 任务已领取
ErrTaskNotFinished Reason = 20003 // 任务未完成
ErrNotBindWallet Reason = 20004 // 未绑定钱包
ErrTaskOpenDateNotSet Reason = 20005 // 任务开放时间未设置
ErrTaskConfNotSet Reason = 20006 // 任务配置未设置
)

View File

@@ -0,0 +1,24 @@
package utils
import (
"context"
"github.com/spf13/cast"
"time"
)
func GetUidUint(ctx context.Context) uint {
uid, _ := cast.ToStringMapInt(ctx.Value("data"))["id"]
return uint(uid)
}
func GetUid(ctx context.Context) int {
uid, _ := cast.ToStringMapInt(ctx.Value("data"))["id"]
return uid
}
func TodayRemainSeconds() int {
now := time.Now()
end, _ := time.ParseInLocation(time.DateOnly, now.Format(time.DateOnly), time.Local)
end = end.AddDate(0, 0, 1)
return int(end.Sub(now).Seconds())
}