@@ -6,7 +6,6 @@ import (
"encoding/hex"
"errors"
"fmt"
- "math"
"mtp2_if/config"
"mtp2_if/global/e"
"mtp2_if/rediscli"
@@ -132,7 +131,8 @@ func Auth() gin.HandlerFunc {
c.Abort()
return
}
- if math.Abs(float64(time.Now().UnixMilli()-int64(t))) > 10*1000 {
+ ts := int64(t) - time.Now().UnixMilli()
+ if ts >= -10*1000 && ts <= 10*1000 {
c.JSON(http.StatusUnauthorized, gin.H{
"code": e.ERROR,
"msg": "apikey3",