From b2ac231af3e5f3f2634dfcc646f5bba3b30aa8ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 20 Nov 2020 11:30:40 +0800 Subject: [PATCH] auth --- business/auth2/authprovider/weixin/weixin_mini.go | 15 +++++++-------- controllers/user2_controller.go | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/business/auth2/authprovider/weixin/weixin_mini.go b/business/auth2/authprovider/weixin/weixin_mini.go index 072ea9573..dc60ccbe7 100644 --- a/business/auth2/authprovider/weixin/weixin_mini.go +++ b/business/auth2/authprovider/weixin/weixin_mini.go @@ -2,7 +2,6 @@ package weixin import ( "errors" - "fmt" "strings" "git.rosy.net.cn/baseapi/platformapi/weixinapi" @@ -57,13 +56,13 @@ func (a *MiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encryptedData if jsCode != "" { sessionInfo, err := getWxApp(appID).SNSCode2Session(jsCode) if err == nil { - if authBindEx, err := a.UnionFindAuthBind(AuthTypeMini, getWxApp(appID).GetAppID(), []string{AuthTypeMini}, sessionInfo.OpenID, "", nil); err == nil { - if authBindEx.UserID != authInfo.GetID() { - return "", fmt.Errorf("jsCode与token不匹配") - } - } else { - return "", err - } + // if authBindEx, err := a.UnionFindAuthBind(AuthTypeMini, getWxApp(appID).GetAppID(), []string{AuthTypeMini}, sessionInfo.OpenID, "", nil); err == nil { + // if authBindEx.UserID != authInfo.GetID() { + // return "", fmt.Errorf("jsCode与token不匹配") + // } + // } else { + // return "", err + // } sessionKey = sessionInfo.SessionKey } else { return "", err diff --git a/controllers/user2_controller.go b/controllers/user2_controller.go index 8acca796f..db20183d2 100644 --- a/controllers/user2_controller.go +++ b/controllers/user2_controller.go @@ -302,7 +302,7 @@ type UserInfoWithWeixin struct { // @router /GetUserByMiniInfo [get] func (c *User2Controller) GetUserByMiniInfo() { c.callGetUserByMiniInfo(func(params *tUser2GetUserByMiniInfoParams) (retVal interface{}, errCode string, err error) { - authInfo, err := params.Ctx.GetV2AuthInfo() + authInfo := &auth2.AuthInfo{} if err == nil { decryptedDataBase64, err2 := weixin.AutherObjMini.DecryptData(authInfo, GetComposedCode(&c.Controller, params.JsCode), params.Data, params.Iv) if err = err2; err == nil {