diff --git a/app/lib/aes/check.go b/app/lib/aes/check.go index 1354ae6..707dbc5 100644 --- a/app/lib/aes/check.go +++ b/app/lib/aes/check.go @@ -77,8 +77,20 @@ func CheckSign(c *gin.Context) error { if err != nil { return err } - if currentTimestamp-storedTimestamp > 300 { // 5分钟 - return fmt.Errorf("签名过期!") + if currentTimestamp-storedTimestamp < 0 { + //TODO::兼容客户端传毫秒 + currentTimestamp = time.Now().UnixMilli() + if currentTimestamp-storedTimestamp > 60*2*1000 { // 2分钟 + return fmt.Errorf("签名过期!") + } + } else { + if currentTimestamp-storedTimestamp > 60*2 { // 2分钟 + return fmt.Errorf("签名过期!") + } + } + + if currentTimestamp-storedTimestamp < 0 { + return errors.New("签名有误!") } return nil }