- ren AuthInfo.ExpiresIn to ExpiresAt

- 将auth2中不是小驼峰的全部修改
This commit is contained in:
gazebo
2019-08-08 17:14:45 +08:00
parent b51614946f
commit af88e9c52e
2 changed files with 15 additions and 15 deletions

View File

@@ -122,7 +122,7 @@ func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) {
authInfo = &AuthInfo{
AuthBindInfo: authBindInfo,
LoginTime: time.Now(),
ExpiresIn: time.Now().Add(DefTokenDuration).Unix(),
ExpiresAt: time.Now().Add(DefTokenDuration).Unix(),
Token: token,
TokenType: tokenType,
}
@@ -131,7 +131,7 @@ func createAuthInfo(user IUser, authBindInfo *AuthBindEx) (authInfo *AuthInfo) {
globals.SugarLogger.Debugf("createAuthInfo id:%s, id2:%s, mobile:%s, authInfo:%s", authInfo.GetID(), authInfo.GetID2(), authInfo.GetMobile(), utils.Format4Output(authInfo, true))
} else {
expireDuration = TmpTokenDuration
authInfo.ExpiresIn = time.Now().Add(expireDuration).Unix()
authInfo.ExpiresAt = time.Now().Add(expireDuration).Unix()
globals.SugarLogger.Debugf("createAuthInfo authInfo:%s", utils.Format4Output(authInfo, true))
}
SetUserInfo(token, authInfo, expireDuration)

View File

@@ -13,11 +13,11 @@ const (
)
type UserBasic struct {
UserID string
UserID2 string
Mobile string
Email string
Name string
UserID string `json:"userID"`
UserID2 string `json:"userID2"`
Mobile string `json:"mobile"`
Email string `json:"email"`
Name string `json:"name"`
}
func (u *UserBasic) GetID() string {
@@ -55,18 +55,18 @@ func (u *UserBasic) IsUserEmpty() bool {
type AuthBindEx struct {
model.AuthBind
UserData interface{} // 认证成功后得到的原始用户信息
UserHint *UserBasic // 认证成功后得到的一些可能的基本用户信息主要有用信息是手机号email与用户名
UserData interface{} `json:"userData"` // 认证成功后得到的原始用户信息
UserHint *UserBasic `json:"userHint"` // 认证成功后得到的一些可能的基本用户信息主要有用信息是手机号email与用户名
}
type AuthInfo struct {
UserBasic // 登录成功后保存的用户信息
AuthBindInfo *AuthBindEx
UserBasic // 登录成功后保存的用户信息
AuthBindInfo *AuthBindEx `json:"authBindInfo"`
LoginTime time.Time
ExpiresIn int64
Token string
TokenType int // TOKEN类型
LoginTime time.Time `json:"loginTime"`
ExpiresAt int64 `json:"expiresAt"`
Token string `json:"token"`
TokenType int `json:"tokenType"` // TOKEN类型
}
func (a *AuthInfo) GetAuthID() string {