增加检查租户模块开通状态的中间件。修改mongo查询list中多字段排序。utils中增加结构体转换
This commit is contained in:
@@ -2,6 +2,7 @@ package utils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net"
|
||||
"reflect"
|
||||
@@ -100,7 +101,6 @@ func GetUserInfo(ctx context.Context) (user beans.User, err error) {
|
||||
} else {
|
||||
user.TenantId = ctx.Value("tenantId")
|
||||
user.UserName = ctx.Value("userName")
|
||||
fmt.Println("user.UserName==================", user.UserName)
|
||||
}
|
||||
if user.TenantId == nil {
|
||||
return user, gerror.New("租户信息为空")
|
||||
@@ -297,3 +297,15 @@ func HexDigit(c byte) byte {
|
||||
return 0xFF
|
||||
}
|
||||
}
|
||||
|
||||
func Struct(params any, pointer any) error {
|
||||
b, err := json.Marshal(params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = json.Unmarshal(b, &pointer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user