From 0dbd1e4afe86f49be013b7feef56e629ffd393ba Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 4 Mar 2019 10:11:08 +0800 Subject: [PATCH] - avoid wrong judge ctx.userInfo == nil --- business/jxutils/jxcontext/jxcontext.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/business/jxutils/jxcontext/jxcontext.go b/business/jxutils/jxcontext/jxcontext.go index c90222db0..4834ca472 100644 --- a/business/jxutils/jxcontext/jxcontext.go +++ b/business/jxutils/jxcontext/jxcontext.go @@ -72,7 +72,10 @@ func New(rootTask tasksch.ITask, token string, w http.ResponseWriter, r *http.Re } } } else { - ctx.userInfo, err = auth.GetUserInfo(token) + userInfo, err2 := auth.GetUserInfo(token) + if err = err2; err == nil { + ctx.userInfo = userInfo + } } if err != nil && beego.BConfig.RunMode == "prod" { globals.SugarLogger.Debugf("token is invalid, token:%s", token)