增加检查租户模块开通状态的中间件。修改mongo查询list中多字段排序。utils中增加结构体转换

This commit is contained in:
2026-01-08 19:09:47 +08:00
committed by 张斌
parent 9b900c1159
commit 91dd762cc6
4 changed files with 155 additions and 4 deletions

View File

@@ -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
}