- export auth2.GetTokenInfo

This commit is contained in:
gazebo
2019-03-11 14:50:25 +08:00
parent 7bcf5f228a
commit 4455e51b3f
3 changed files with 22 additions and 2 deletions

View File

@@ -303,8 +303,7 @@ func RemoveUserInfo(token string) {
}
func GetTokenInfo(token string) (authInfo *AuthInfo, err error) {
authInfo = new(AuthInfo)
if err = api.Cacher.GetAs(token, authInfo); err == nil {
if err = api.Cacher.GetAs(token, &authInfo); err == nil {
return authInfo, nil
}
return nil, model.ErrTokenIsInvalid

View File

@@ -73,6 +73,19 @@ func (c *Auth2Controller) Login() {
})
}
// @Title 钉钉认证回调接口
// @Description 钉钉认证回调接口,自己不能直接调用
// @Param token header string true "认证token"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetTokenInfo [get]
func (c *Auth2Controller) GetTokenInfo() {
c.callGetTokenInfo(func(params *tAuth2GetTokenInfoParams) (retVal interface{}, errCode string, err error) {
retVal, err = auth2.GetTokenInfo(params.Token)
return retVal, "", err
})
}
// @Title 微信认证回调接口
// @Description 微信认证回调接口,自己不能直接调用
// @Param code query string true "客户同意后得到的code"

View File

@@ -39,6 +39,14 @@ func init() {
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"],
beego.ControllerComments{
Method: "GetTokenInfo",
Router: `/GetTokenInfo`,
AllowHTTPMethods: []string{"get"},
MethodParams: param.Make(),
Params: nil})
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:Auth2Controller"],
beego.ControllerComments{
Method: "Login",