fix🐛: Adjust the demo environment configuration

This commit is contained in:
zhangwenjian committed 2022-11-09 17:35:16 +08:00
1 parent 42f3025217
commit ddd97d5a9e
4 files changed
+7 -30

No files matched your search

+1 -5
View File
@@ -1,7 +1,6 @@
package handler
import (
"fmt"
"go-admin/app/admin/models"
"go-admin/common"
"net/http"
@@ -16,8 +15,6 @@ 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"
)
@@ -119,8 +116,7 @@ func LoginLogToDB(c *gin.Context, status string, msg string, username string) {
ua := user_agent.New(c.Request.UserAgent())
l["ipaddr"] = common.GetClientIP(c)
fmt.Println("gaConfig.ExtConfig.AMap.Key", gaConfig.ExtConfig.AMap.Key)
l["loginLocation"] = pkg.GetLocation(common.GetClientIP(c),gaConfig.ExtConfig.AMap.Key)
l["loginLocation"] = "" // pkg.GetLocation(common.GetClientIP(c),gaConfig.ExtConfig.AMap.Key)
l["loginTime"] = pkg.GetCurrentTime()
l["status"] = status
l["remark"] = c.Request.UserAgent()
+2 -2
View File
@@ -14,6 +14,7 @@ const (
)
func InitMiddleware(r *gin.Engine) {
r.Use(DemoEvn())
// 数据库链接
r.Use(WithContextDb)
// 日志处理
@@ -26,10 +27,9 @@ func InitMiddleware(r *gin.Engine) {
r.Use(Options)
// Secure is a middleware function that appends security
r.Use(Secure)
//r.Use(DemoEvn())
// 链路追踪
//r.Use(middleware.Trace())
sdk.Runtime.SetMiddleware(JwtTokenCheck, (*jwt.GinJWTMiddleware).MiddlewareFunc)
sdk.Runtime.SetMiddleware(RoleCheck, AuthCheckRole())
sdk.Runtime.SetMiddleware(PermissionCheck, actions.PermissionAction())
}
}
+1 -5
View File
@@ -4,10 +4,8 @@ import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"go-admin/app/admin/service/dto"
"go-admin/common"
gaConfig "go-admin/config"
"io"
"io/ioutil"
"net/http"
@@ -18,7 +16,6 @@ import (
"github.com/go-admin-team/go-admin-core/sdk"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/config"
"github.com/go-admin-team/go-admin-core/sdk/pkg"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
"go-admin/common/global"
@@ -109,8 +106,7 @@ func SetDBOperLog(c *gin.Context, clientIP string, statusCode int, reqUri string
l["_fullPath"] = c.FullPath()
l["operUrl"] = reqUri
l["operIp"] = clientIP
fmt.Println("gaConfig.ExtConfig.AMap.Key", gaConfig.ExtConfig.AMap.Key)
l["operLocation"] = pkg.GetLocation(clientIP, gaConfig.ExtConfig.AMap.Key)
l["operLocation"] = "" // pkg.GetLocation(clientIP, gaConfig.ExtConfig.AMap.Key)
l["operName"] = user.GetUserName(c)
l["requestMethod"] = reqMethod
l["operParam"] = body