This commit is contained in:
suyl
2021-04-27 09:29:08 +08:00
parent 4095161df5
commit e5d02223b7

View File

@@ -207,7 +207,7 @@ func (c *Auth2Controller) WeixinMPOAuth2() {
}
}
if params.Block != "" {
if moblie := params.Block[strings.LastIndex(params.Block,"=")+1:]; moblie != "" {
if moblie := params.Block[strings.LastIndex(params.Block, "=")+1:]; moblie != "" {
if user, err := dao.GetUserByID(dao.GetDB(), "mobile", moblie); err == nil {
if user != nil {
authInfo.AuthBindInfo.UserID = user.UserID
@@ -219,8 +219,8 @@ func (c *Auth2Controller) WeixinMPOAuth2() {
}
}
}
if strings.Contains(params.Block,"?"){
params.Block = params.Block[:strings.LastIndex(params.Block,"?" )]
if strings.Contains(params.Block, "?") {
params.Block = params.Block[:strings.LastIndex(params.Block, "?")]
}
redirectURL = fmt.Sprintf("%s?info=%s", params.Block, base64.StdEncoding.EncodeToString(utils.MustMarshal(callResult)))
return retVal, model.ErrorCodeIgnore, err
@@ -308,6 +308,22 @@ func (c *Auth2Controller) AddAuthBind() {
})
}
// @Title 绑定认证方式
// @Description 绑定认证方式
// @Param token header string true "认证token"
// @Param authToken formData string true "之前通过login得到的新认证TOKEN"
// @Param mobile formData string true "之前通过getuserbyminiinfo得到的"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /AddAuthBindWithMobile [post]
func (c *Auth2Controller) AddAuthBindWithMobile() {
c.callAddAuthBindWithMobile(func(params *tAuth2AddAuthBindWithMobileParams) (retVal interface{}, errCode string, err error) {
newAuthInfo, err := auth2.GetTokenInfo(params.AuthToken)
err = auth2.AddAuthBindWithMobile(newAuthInfo, params.Mobile)
return retVal, "", err
})
}
// @Title 删除认证方式
// @Description 删除认证方式
// @Param token header string true "认证token"