作者 tangxvhui

更新接口 获取登录用户信息

@@ -60,12 +60,13 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface @@ -60,12 +60,13 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface
60 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用") 60 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用")
61 } 61 }
62 userAuth := &domain.UserAuth{ 62 userAuth := &domain.UserAuth{
63 - UserId: user.Id,  
64 - CompanyId: user.CompanyId,  
65 - Phone: user.Account,  
66 - PlatformId: loginCommand.PlatformId,  
67 - Name: user.Name,  
68 - AdminType: user.AdminType, 63 + UserId: user.Id,
  64 + CompanyId: user.CompanyId,
  65 + CompanyName: company.Name,
  66 + Phone: user.Account,
  67 + PlatformId: loginCommand.PlatformId,
  68 + Name: user.Name,
  69 + AdminType: user.AdminType,
69 } 70 }
70 accessToken, err := userAuth.CreateAccessToken() 71 accessToken, err := userAuth.CreateAccessToken()
71 if err != nil { 72 if err != nil {
@@ -132,12 +133,13 @@ func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[ @@ -132,12 +133,13 @@ func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[
132 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用") 133 return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用")
133 } 134 }
134 userAuth := &domain.UserAuth{ 135 userAuth := &domain.UserAuth{
135 - UserId: user.Id,  
136 - CompanyId: user.CompanyId,  
137 - Phone: user.Account,  
138 - PlatformId: constant.IdPlatformUser,  
139 - Name: user.Name,  
140 - AdminType: user.AdminType, 136 + UserId: user.Id,
  137 + CompanyId: user.CompanyId,
  138 + CompanyName: company.Name,
  139 + Phone: user.Account,
  140 + PlatformId: constant.IdPlatformUser,
  141 + Name: user.Name,
  142 + AdminType: user.AdminType,
141 } 143 }
142 accessToken, err := userAuth.CreateAccessToken() 144 accessToken, err := userAuth.CreateAccessToken()
143 if err != nil { 145 if err != nil {
@@ -2,14 +2,16 @@ package domain @@ -2,14 +2,16 @@ package domain
2 2
3 import ( 3 import (
4 "errors" 4 "errors"
5 - "github.com/dgrijalva/jwt-go"  
6 "time" 5 "time"
  6 +
  7 + "github.com/dgrijalva/jwt-go"
7 ) 8 )
8 9
9 type UserAuth struct { 10 type UserAuth struct {
10 jwt.StandardClaims `json:"-"` 11 jwt.StandardClaims `json:"-"`
11 UserId int64 `json:"userId"` 12 UserId int64 `json:"userId"`
12 CompanyId int64 `json:"companyId"` 13 CompanyId int64 `json:"companyId"`
  14 + CompanyName string `json:"companyName"`
13 Phone string `json:"phone"` 15 Phone string `json:"phone"`
14 PlatformId int `json:"platformId"` 16 PlatformId int `json:"platformId"`
15 Name string `json:"name"` 17 Name string `json:"name"`