This commit is contained in:
苏尹岚
2021-04-02 15:59:40 +08:00
parent e66e0d68d7
commit d4a861e8af

View File

@@ -2,7 +2,6 @@ package weixin
import ( import (
"errors" "errors"
"fmt"
"strings" "strings"
"git.rosy.net.cn/baseapi/platformapi/weixinapi" "git.rosy.net.cn/baseapi/platformapi/weixinapi"
@@ -57,13 +56,13 @@ func (a *MiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encryptedData
if jsCode != "" { if jsCode != "" {
sessionInfo, err := getWxApp(appID).SNSCode2Session(jsCode) sessionInfo, err := getWxApp(appID).SNSCode2Session(jsCode)
if err == nil { if err == nil {
if authBindEx, err := a.UnionFindAuthBind(AuthTypeMini, getWxApp(appID).GetAppID(), []string{AuthTypeMini}, sessionInfo.OpenID, "", nil); err == nil { // if authBindEx, err := a.UnionFindAuthBind(AuthTypeMini, getWxApp(appID).GetAppID(), []string{AuthTypeMini}, sessionInfo.OpenID, "", nil); err == nil {
if authBindEx.UserID != authInfo.GetID() { // if authBindEx.UserID != authInfo.GetID() {
return "", fmt.Errorf("jsCode与token不匹配") // return "", fmt.Errorf("jsCode与token不匹配")
} // }
} else { // } else {
return "", err // return "", err
} // }
sessionKey = sessionInfo.SessionKey sessionKey = sessionInfo.SessionKey
} else { } else {
return "", err return "", err
@@ -79,7 +78,7 @@ func (a *MiniAuther) DecryptData(authInfo *auth2.AuthInfo, jsCode, encryptedData
if err != nil { if err != nil {
return "", err return "", err
} }
authInfo.AuthBindInfo.UserData = sessionKey // authInfo.AuthBindInfo.UserData = sessionKey
return string(decryptedData), nil return string(decryptedData), nil
} }