From 9eec00378565c0b831d102b88c0a15aa59335125 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B0=E4=BA=AE?= Date: Tue, 8 Oct 2019 19:32:40 +0800 Subject: [PATCH] =?UTF-8?q?Update=20MD5=20=E7=AD=BE=E5=90=8D=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/config/config.go | 9 ++++----- app/route/middleware/sign/md5/md5.go | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/config/config.go b/app/config/config.go index cf4befd..46d93c3 100644 --- a/app/config/config.go +++ b/app/config/config.go @@ -6,11 +6,10 @@ const ( AppName = "go-gin-api" // MD5 密钥 - AppSignSecret = "4OhYXtDYNYxQsGetqASVOTP37jGt5gGY" - - // MD5 签名超时时间 120s - AppSignExpiry = "120" + AppMD5SignSecret = "4OhYXtDYNYxQsGetqASVOTP37jGt5gGY" + // MD5 超时时间 + AppMD5SignExpiry = "120" // 超时时间 AppReadTimeout = 120 @@ -34,7 +33,7 @@ const ( ErrorNotifyOpen = -1 // Jaeger 配置信息 - JaegerHostPort = "127.0.0.1:6831" + JaegerHostPort = "127.0.0.1:6831" // Jaeger 配置开关 1=开通 -1=关闭 JaegerOpen = 1 diff --git a/app/route/middleware/sign/md5/md5.go b/app/route/middleware/sign/md5/md5.go index acbf20c..403d629 100644 --- a/app/route/middleware/sign/md5/md5.go +++ b/app/route/middleware/sign/md5/md5.go @@ -55,7 +55,7 @@ func createMD5Sign(params url.Values) string { } // 自定义签名算法 - sign := util.MD5(config.AppSignSecret + str + config.AppSignSecret) + sign := util.MD5(config.AppMD5SignSecret + str + config.AppMD5SignSecret) return sign } @@ -92,7 +92,7 @@ func verifyMD5Sign(c *gin.Context) (map[string]string, error) { return res, nil } - exp, _ := strconv.ParseInt(config.AppSignExpiry, 10, 64) + exp, _ := strconv.ParseInt(config.AppMD5SignExpiry, 10, 64) // 验证过期时间 timestamp := time.Now().Unix()