k3-cat месяцев назад: 7
Родитель
Сommit
af4813db30
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      service/user.go

+ 4 - 3
service/user.go

@@ -2,14 +2,14 @@ package service
2 2
 
3 3
 import (
4 4
 	"errors"
5
-	"github.com/lejianwen/rustdesk-api/v2/model"
6
-	"github.com/lejianwen/rustdesk-api/v2/utils"
7 5
 	"math/rand"
8 6
 	"strconv"
9 7
 	"strings"
10 8
 	"time"
11 9
 
12 10
 	"github.com/gin-gonic/gin"
11
+	"github.com/lejianwen/rustdesk-api/v2/model"
12
+	"github.com/lejianwen/rustdesk-api/v2/utils"
13 13
 	"gorm.io/gorm"
14 14
 )
15 15
 
@@ -500,8 +500,9 @@ func (us *UserService) RefreshAccessToken(ut *model.UserToken) {
500 500
 	ut.ExpiredAt = us.UserTokenExpireTimestamp()
501 501
 	DB.Model(ut).Update("expired_at", ut.ExpiredAt)
502 502
 }
503
+
503 504
 func (us *UserService) AutoRefreshAccessToken(ut *model.UserToken) {
504
-	if ut.ExpiredAt-time.Now().Unix() < 86400 {
505
+	if ut.ExpiredAt-time.Now().Unix() < Config.App.TokenExpire.Milliseconds()/3000 {
505 506
 		us.RefreshAccessToken(ut)
506 507
 	}
507 508
 }