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}}
func DefaultValidToken(ctx context.Context) *basic.UserInfo {
var (
err error
@ -82,9 +81,11 @@ func DefaultValidToken(ctx context.Context) *basic.UserInfo {
defer func() {
if vresult != nil {
userinfo := vresult.UserInfo.AsMap()
ui.UserId = int64(userinfo["user_id"].(float64))
ui.GuestId = int64(userinfo["guest_id"].(float64))
ui.Exp = int64(userinfo["exp"].(float64))
if len(userinfo) != 0 {
ui.UserId = int64(userinfo["user_id"].(float64))
ui.GuestId = int64(userinfo["guest_id"].(float64))
ui.Exp = int64(userinfo["exp"].(float64))
}
}
}()
}
@ -102,13 +103,15 @@ func DefaultValidToken(ctx context.Context) *basic.UserInfo {
defer func() {
if vresult != nil {
debug := vresult.DebugInfo.AsMap()
ui.Debug = &basic.Debug{}
if dexp, ok := debug["exp"]; ok {
dexpint64 := int64(dexp.(float64))
ui.Debug.Exp = &dexpint64
if len(debug) != 0 {
ui.Debug = &basic.Debug{}
if dexp, ok := debug["exp"]; ok {
dexpint64 := int64(dexp.(float64))
ui.Debug.Exp = &dexpint64
}
ui.Debug.IsAllTemplateTag = int64(debug["is_all_template_tag"].(float64))
ui.Debug.IsCache = int64(debug["is_cache"].(float64))
}
ui.Debug.IsAllTemplateTag = int64(debug["is_all_template_tag"].(float64))
ui.Debug.IsCache = int64(debug["is_cache"].(float64))
}
}()
}