From 49c6febdf0110d46eea92ab5151122215a5ba774 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Thu, 10 Jun 2021 11:24:17 +0800 Subject: [PATCH] =?UTF-8?q?refactor=F0=9F=8E=A8:=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E4=BD=8D=E7=BD=AE=E8=8E=B7=E5=8F=96=E5=87=BD?= =?UTF-8?q?=E6=95=B0=E6=B7=BB=E5=8A=A0key=E4=BC=A0=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/middleware/handler/auth.go | 3 ++- common/middleware/logger.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/common/middleware/handler/auth.go b/common/middleware/handler/auth.go index 8b15f17c..a685c71f 100644 --- a/common/middleware/handler/auth.go +++ b/common/middleware/handler/auth.go @@ -14,6 +14,7 @@ import ( "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user" "github.com/go-admin-team/go-admin-core/sdk/pkg/response" "github.com/mssola/user_agent" + gaConfig "go-admin/config" "go-admin/common/global" ) @@ -115,7 +116,7 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) { ua := user_agent.New(c.Request.UserAgent()) l["ipaddr"] = c.ClientIP() - l["loginLocation"] = pkg.GetLocation(c.ClientIP()) + l["loginLocation"] = pkg.GetLocation(c.ClientIP(),gaConfig.ExtConfig.AMap.Key) l["loginTime"] = pkg.GetCurrentTime() l["status"] = status l["remark"] = c.Request.UserAgent() diff --git a/common/middleware/logger.go b/common/middleware/logger.go index 1f31b2f4..0b9f5701 100644 --- a/common/middleware/logger.go +++ b/common/middleware/logger.go @@ -4,6 +4,7 @@ import ( "bufio" "bytes" "encoding/json" + gaConfig "go-admin/config" "io" "io/ioutil" "net/http" @@ -104,7 +105,7 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string l["_fullPath"] = c.FullPath() l["operUrl"] = reqUri l["operIp"] = clientIP - l["operLocation"] = pkg.GetLocation(clientIP) + l["operLocation"] = pkg.GetLocation(clientIP, gaConfig.ExtConfig.AMap.Key) l["operName"] = user.GetUserName(c) l["requestMethod"] = c.Request.Method l["operParam"] = body