添加美团超市账号信息通知果园

This commit is contained in:
邹宗楠
2023-02-06 11:30:23 +08:00
parent 21d80bf232
commit 97997f0e79
3 changed files with 63 additions and 33 deletions

View File

@@ -225,14 +225,14 @@ func (c *Auth2Controller) WeixinMPOAuth2() {
}
}
if params.Block != "" {
if moblie := params.Block[strings.LastIndex(params.Block, "=")+1:]; moblie != "" {
if user, err := dao.GetUserByID(dao.GetDB(), "mobile", moblie); err == nil {
if mobile := params.Block[strings.LastIndex(params.Block, "=")+1:]; mobile != "" {
if user, err := dao.GetUserByID(dao.GetDB(), "mobile", mobile); err == nil {
if user != nil {
authInfo.AuthBindInfo.UserID = user.UserID
authInfo.AuthBindInfo.AuthBind.UserID = user.UserID
auth2.AddAuthBind(user, authInfo)
} else {
return retVal, errCode, fmt.Errorf("未查询到用户mobile :%v", moblie)
return retVal, errCode, fmt.Errorf("未查询到用户mobile :%v", mobile)
}
}
}
@@ -241,10 +241,9 @@ func (c *Auth2Controller) WeixinMPOAuth2() {
params.Block = params.Block[:strings.LastIndex(params.Block, "?")]
}
redirectURL = fmt.Sprintf("%s?info=%s", params.Block, base64.StdEncoding.EncodeToString(utils.MustMarshal(callResult)))
globals.SugarLogger.Debugf("===redirectURL=== %s", redirectURL)
globals.SugarLogger.Debugf("===retVal=== %s", utils.Format4Output(retVal, false))
return retVal, model.ErrorCodeIgnore, err
})
globals.SugarLogger.Debugf("redirectURL=====: %s", redirectURL)
c.Redirect(redirectURL, http.StatusTemporaryRedirect)
}