Merge remote-tracking branch 'origin/mark' into don
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user