修复时间问题

This commit is contained in:
ZJY 2021-09-03 19:50:34 +08:00
parent c22c609557
commit 99fe27275b
2 changed files with 4 additions and 3 deletions

View File

@ -366,11 +366,12 @@ func (c *Container) getToken() error {
}
} else {
logs.Info("缓存token")
h, _ := time.ParseDuration("+624h")
h, _ := time.ParseDuration("-624h")
tZero := time.Now().Add(h)
logs.Info(tZero)
logs.Info(token.Expiration)
if tZero.Before(token.Expiration) {
t_ := token.Expiration.Sub(tZero)
if t_ > 0 {
err2, done := getT(c, token)
if done {
return err2

View File

@ -322,5 +322,5 @@ func setSqlToken(token *Token) error {
func getSqlToken() (*Token, error) {
token := &Token{}
return token, db.Order("expiration asc").First(token).Error
return token, db.Order("expiration desc").First(token).Error
}