Commit cd735ace authored by hujiebin's avatar hujiebin

Revert "fix:修复获取用户信息的问题"

This reverts commit b335e750.
parent b335e750
......@@ -7,7 +7,6 @@ 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"
......@@ -89,12 +88,26 @@ 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)
user, err := user_m.GetUser(domain.CreateModelContext(myContext), userId)
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
}
}
return 0, "", "", "", "", bizerr.ParaMissing
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment