From b335e750b889044f9f1abb845c5aa0e80f5b8df2 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Fri, 24 Mar 2023 18:00:40 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- req/request.go | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/req/request.go b/req/request.go index 39ae35f..6dcb235 100644 --- a/req/request.go +++ b/req/request.go @@ -7,6 +7,7 @@ import ( "github.com/gin-gonic/gin" "hilo-group/domain/cache/user_c" "hilo-group/domain/model/res_m" + "hilo-group/domain/model/user_m" "hilo-group/myerr" "hilo-group/myerr/bizerr" "strconv" @@ -88,25 +89,11 @@ func GetUserIdLang(c *gin.Context, myContext *mycontext.MyContext) (mysql.ID, st func GetUserEx(c *gin.Context, myContext *mycontext.MyContext) (mysql.ID, string, string, string, string, error) { if userIdStr, ok := c.Keys[mycontext.USERID]; ok { userId := userIdStr.(uint64) - - externalId, ok1 := c.Get(mycontext.EXTERNAL_ID) - nick, ok2 := c.Get(mycontext.NICK) - avatar, ok3 := c.Get(mycontext.AVATAR) - country, ok4 := c.Get(mycontext.COUNTRY) - ok := ok1 && ok2 && ok3 && ok4 - if ok { - return userId, externalId.(string), nick.(string), avatar.(string), country.(string), nil - } else { - //var user user_m.User - //if err := mysql.Db.First(&user, userId).Error; err != nil { - // return 0, "", "", "", "", bizerr.ExternalIdNoExist - //} - user, err := user_c.GetUserTinyById(domain.CreateModelContext(myContext), userId) - if err != nil { - return 0, "", "", "", "", bizerr.ExternalIdNoExist - } - return userId, user.ExternalId, user.Nick, user.Avatar, user.Country, nil + user, err := user_m.GetUser(domain.CreateModelContext(myContext), userId) + if err != nil { + return 0, "", "", "", "", bizerr.ExternalIdNoExist } + return userId, user.ExternalId, user.Nick, user.Avatar, user.Country, nil } return 0, "", "", "", "", bizerr.ParaMissing } -- 2.22.0