nft质押任务逻辑
This commit is contained in:
24
internal/pkg/utils/utils.go
Normal file
24
internal/pkg/utils/utils.go
Normal 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())
|
||||
}
|
||||
Reference in New Issue
Block a user