Merge remote-tracking branch 'origin/mark' into don

This commit is contained in:
Rosy-zhudan
2019-08-08 09:14:21 +08:00
20 changed files with 538 additions and 87 deletions

View File

@@ -129,3 +129,22 @@ func (ctx *Context) GetV2AuthInfo() (authInfo *auth2.AuthInfo, err error) {
func (ctx *Context) GetTrackInfo() string {
return ctx.Context.GetTrackInfo() + "," + ctx.GetUserName()
}
func (ctx *Context) GetMobileAndUserID() (mobile, userID string) {
token := ctx.GetToken()
if auth2.IsV2Token(token) {
authInfo, err2 := auth2.GetTokenInfo(token)
if err2 == nil {
if authInfo.TokenType == auth2.TokenTypeNormal {
mobile = authInfo.GetMobile()
userID = authInfo.GetID()
}
}
} else {
userInfo, err2 := auth.GetUserInfo(token)
if err2 == nil {
mobile = userInfo.GetAuthID()
}
}
return mobile, userID
}