This commit is contained in:
huangsimin@fusen.cn 2023-11-29 17:41:30 +08:00
parent 4f231d545b
commit 57fd3eb516

View File

@ -61,7 +61,6 @@ func (lgrpc *{{.StructName}}Grpc) {{.MethodName}}(ctx {{.ParamCtx}}, req {{.Para
} }
{{end}} {{end}}
func DefaultValidToken(ctx context.Context) *basic.UserInfo { func DefaultValidToken(ctx context.Context) *basic.UserInfo {
var ( var (
err error err error
@ -82,10 +81,12 @@ func DefaultValidToken(ctx context.Context) *basic.UserInfo {
defer func() { defer func() {
if vresult != nil { if vresult != nil {
userinfo := vresult.UserInfo.AsMap() userinfo := vresult.UserInfo.AsMap()
if len(userinfo) != 0 {
ui.UserId = int64(userinfo["user_id"].(float64)) ui.UserId = int64(userinfo["user_id"].(float64))
ui.GuestId = int64(userinfo["guest_id"].(float64)) ui.GuestId = int64(userinfo["guest_id"].(float64))
ui.Exp = int64(userinfo["exp"].(float64)) ui.Exp = int64(userinfo["exp"].(float64))
} }
}
}() }()
} }
@ -102,6 +103,7 @@ func DefaultValidToken(ctx context.Context) *basic.UserInfo {
defer func() { defer func() {
if vresult != nil { if vresult != nil {
debug := vresult.DebugInfo.AsMap() debug := vresult.DebugInfo.AsMap()
if len(debug) != 0 {
ui.Debug = &basic.Debug{} ui.Debug = &basic.Debug{}
if dexp, ok := debug["exp"]; ok { if dexp, ok := debug["exp"]; ok {
dexpint64 := int64(dexp.(float64)) dexpint64 := int64(dexp.(float64))
@ -110,6 +112,7 @@ func DefaultValidToken(ctx context.Context) *basic.UserInfo {
ui.Debug.IsAllTemplateTag = int64(debug["is_all_template_tag"].(float64)) ui.Debug.IsAllTemplateTag = int64(debug["is_all_template_tag"].(float64))
ui.Debug.IsCache = int64(debug["is_cache"].(float64)) ui.Debug.IsCache = int64(debug["is_cache"].(float64))
} }
}
}() }()
} }
} }