作者 tangxvhui

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

... ... @@ -60,12 +60,13 @@ func (service *AuthService) Login(loginCommand *command.LoginCommand) (interface
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用")
}
userAuth := &domain.UserAuth{
UserId: user.Id,
CompanyId: user.CompanyId,
Phone: user.Account,
PlatformId: loginCommand.PlatformId,
Name: user.Name,
AdminType: user.AdminType,
UserId: user.Id,
CompanyId: user.CompanyId,
CompanyName: company.Name,
Phone: user.Account,
PlatformId: loginCommand.PlatformId,
Name: user.Name,
AdminType: user.AdminType,
}
accessToken, err := userAuth.CreateAccessToken()
if err != nil {
... ... @@ -132,12 +133,13 @@ func (service *AuthService) MobileLogin(param *command.MobileLoginCommand) (map[
return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, "用户被禁用")
}
userAuth := &domain.UserAuth{
UserId: user.Id,
CompanyId: user.CompanyId,
Phone: user.Account,
PlatformId: constant.IdPlatformUser,
Name: user.Name,
AdminType: user.AdminType,
UserId: user.Id,
CompanyId: user.CompanyId,
CompanyName: company.Name,
Phone: user.Account,
PlatformId: constant.IdPlatformUser,
Name: user.Name,
AdminType: user.AdminType,
}
accessToken, err := userAuth.CreateAccessToken()
if err != nil {
... ...
... ... @@ -2,14 +2,16 @@ package domain
import (
"errors"
"github.com/dgrijalva/jwt-go"
"time"
"github.com/dgrijalva/jwt-go"
)
type UserAuth struct {
jwt.StandardClaims `json:"-"`
UserId int64 `json:"userId"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
Phone string `json:"phone"`
PlatformId int `json:"platformId"`
Name string `json:"name"`
... ...