...
|
...
|
@@ -49,15 +49,18 @@ func ParseContext(c beego.BaseController) *domain.Context { |
|
|
userToken, ok := token.(*domain.UserToken)
|
|
|
if ok {
|
|
|
// cache user info
|
|
|
key := cache.KeyCompanyUser(companyId, userId)
|
|
|
if userToken.UserId != 0 {
|
|
|
key := cache.KeyCompanyUser(int(userToken.CompanyId), int(userToken.UserId))
|
|
|
if userToken.CheckUserInfo() {
|
|
|
if cacheItem, ok := cache.DefaultCache.Get(key); ok {
|
|
|
v := cacheItem.(*authlib.DataUserMe)
|
|
|
userName = v.User.NickName
|
|
|
} else {
|
|
|
requestToken, _ := userToken.GenerateToken()
|
|
|
authLib := authlib.NewApiAuthLib(constant.AUTH_SERVER_HOST).WithToken(requestToken)
|
|
|
userInfo, err := authLib.MeInfo(authlib.RequestUserMeQuery{})
|
|
|
userInfo, err := authLib.MeInfo(authlib.RequestUserMeQuery{
|
|
|
UserId: int(userToken.UserId),
|
|
|
CompanyId: int(userToken.CompanyId),
|
|
|
})
|
|
|
if err != nil || userInfo == nil || userInfo.User == nil {
|
|
|
goto END
|
|
|
}
|
...
|
...
|
|