This commit is contained in:
苏尹岚
2021-04-09 11:31:23 +08:00
parent f062cb371c
commit 4078d6f8e3
2 changed files with 19 additions and 12 deletions

View File

@@ -2,6 +2,7 @@ package weixin
import (
"errors"
"fmt"
"strings"
"git.rosy.net.cn/baseapi/platformapi/weixinapi"
@@ -56,13 +57,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