merge: 合并代码20240531
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"be.ems/lib/services"
|
||||
)
|
||||
|
||||
// 已禁用
|
||||
// 登录策略限制登录时间和访问ip范围
|
||||
func ArrowIPAddr(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
tokenUtils "be.ems/src/framework/utils/token"
|
||||
)
|
||||
|
||||
// 已禁用由Gin部分接管
|
||||
// Authorize 用户身份授权认证校验
|
||||
//
|
||||
// 只需含有其中角色 "hasRoles": {"xxx"},
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 已禁用由Gin部分接管
|
||||
// Cors 跨域
|
||||
func Cors(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -11,8 +11,8 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"be.ems/lib/core/utils/ctx"
|
||||
"be.ems/lib/core/utils/parse"
|
||||
"be.ems/lib/dborm"
|
||||
"be.ems/src/framework/constants/common"
|
||||
"be.ems/src/framework/middleware/collectlogs"
|
||||
"be.ems/src/framework/utils/ip2region"
|
||||
@@ -47,13 +47,7 @@ func LogOperate(options collectlogs.Options) func(http.Handler) http.Handler {
|
||||
funcName = funcName[lastDotIndex+1:]
|
||||
|
||||
// 用户名
|
||||
username := "-"
|
||||
accessToken := r.Header.Get("AccessToken")
|
||||
if accessToken != "" {
|
||||
// 验证令牌 == 这里直接查数据库session
|
||||
se, _ := dborm.XormUpdateSessionShakeTime(accessToken)
|
||||
username = se.AccountId
|
||||
}
|
||||
username := ctx.LoginUserToUserName(r)
|
||||
|
||||
// 解析ip地址
|
||||
ip := strings.Split(r.RemoteAddr, ":")[0]
|
||||
|
||||
Reference in New Issue
Block a user