refactor🎨: 日志中的位置获取函数添加key传入
This commit is contained in:
1 parent
3d620d0149
commit
49c6febdf0
2 files changed
+4
-2
No files matched your search
@@ -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/jwtauth/user"
|
||||||
"github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
"github.com/go-admin-team/go-admin-core/sdk/pkg/response"
|
||||||
"github.com/mssola/user_agent"
|
"github.com/mssola/user_agent"
|
||||||
|
gaConfig "go-admin/config"
|
||||||
|
|
||||||
"go-admin/common/global"
|
"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())
|
ua := user_agent.New(c.Request.UserAgent())
|
||||||
l["ipaddr"] = c.ClientIP()
|
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["loginTime"] = pkg.GetCurrentTime()
|
||||||
l["status"] = status
|
l["status"] = status
|
||||||
l["remark"] = c.Request.UserAgent()
|
l["remark"] = c.Request.UserAgent()
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
gaConfig "go-admin/config"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
@@ -104,7 +105,7 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string
|
|||||||
l["_fullPath"] = c.FullPath()
|
l["_fullPath"] = c.FullPath()
|
||||||
l["operUrl"] = reqUri
|
l["operUrl"] = reqUri
|
||||||
l["operIp"] = clientIP
|
l["operIp"] = clientIP
|
||||||
l["operLocation"] = pkg.GetLocation(clientIP)
|
l["operLocation"] = pkg.GetLocation(clientIP, gaConfig.ExtConfig.AMap.Key)
|
||||||
l["operName"] = user.GetUserName(c)
|
l["operName"] = user.GetUserName(c)
|
||||||
l["requestMethod"] = c.Request.Method
|
l["requestMethod"] = c.Request.Method
|
||||||
l["operParam"] = body
|
l["operParam"] = body
|
||||||
|
|||||||
Reference in new issue
Block a user