- 角色管理初版

This commit is contained in:
gazebo
2019-08-07 18:16:44 +08:00
parent 059be1befd
commit 3639a1c7cb
14 changed files with 500 additions and 72 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
}