push config

This commit is contained in:
richboo111
2023-07-06 10:18:41 +08:00
parent 4debcc1c5d
commit da87f4e2f4
7 changed files with 83 additions and 46 deletions

View File

@@ -7,8 +7,6 @@ import (
"strings"
"time"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/auth2"
"git.rosy.net.cn/jx-callback/business/model"
@@ -80,24 +78,6 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
} else if dao.IsNoRowsError(err) { // 直接找不到尝试unionID
if unionID != "" || openID != "" { // 且有unionID
var authBindList []*model.AuthBind
//authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID, nil)
//if err != nil {
// return nil, err
//}
//if len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
// authBind = authBindList[0]
// authBind.Type = curAuthType
// authBind.TypeID = curAuthTypeID
// authBind.AuthID = openID
// if authDetail != nil {
// authBind.DetailData = string(utils.MustMarshal(authDetail))
// }
// authBindEx = &auth2.AuthBindEx{
// AuthBind: *authBind,
// }
// a.UnbindAuth(authBind.UserID, curAuthType, curAuthTypeID, model.AdminName)
// err = a.AddAuthBind(authBindEx, model.AdminName) // 自动绑定
//}
if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, openID, unionID, nil); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式
authBind = authBindList[0]
authBind.Type = curAuthType
@@ -112,18 +92,14 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
a.UnbindAuth(authBind.UserID, curAuthType, curAuthTypeID, model.AdminName)
err = a.AddAuthBind(authBindEx, model.AdminName) // 自动绑定
} else if dao.IsNoRowsError(err) {
globals.SugarLogger.Debugf("dao.IsNoRowsError(err)=%s,err=%v", dao.IsNoRowsError(err), err)
err = nil
}
} else {
err = nil
}
}
globals.SugarLogger.Debugf("authBindList err=%v", err)
globals.SugarLogger.Debugf("authBindList authBindEx=%v", err)
if err == nil && authBindEx == nil {
//如果没有报错且没有找到一个认证方式创建无用户UserID为空的认证方式
globals.SugarLogger.Debugf("进入添加无用户认证方式")
authBindEx = &auth2.AuthBindEx{
AuthBind: model.AuthBind{
Type: curAuthType,
@@ -135,8 +111,6 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu
if authDetail != nil {
authBindEx.DetailData = string(utils.MustMarshal(authDetail))
}
globals.SugarLogger.Debugf("authBindEx=%s", utils.Format4Output(authBindEx, false))
}
return authBindEx, err
}

View File

@@ -3,9 +3,6 @@ package weixin
import (
"errors"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/baseapi/platformapi/weixinapi"
"git.rosy.net.cn/jx-callback/business/auth2"
"git.rosy.net.cn/jx-callback/business/auth2/authprovider"
@@ -88,7 +85,6 @@ func (a *Auther) VerifySecret(id, secret string) (authBindEx *auth2.AuthBindEx,
}
if err == nil {
wxUserinfo, err2 := a.getAPI().SNSGetUserInfo(accessToken, openID)
globals.SugarLogger.Debugf("wxUserinfo=%s", utils.Format4Output(wxUserinfo, false))
if err = err2; err == nil {
if authBindEx, err = a.UnionFindAuthBind(a.authType, a.getAPI().GetAppID(), []string{AuthTypeWeixin, AuthTypeMP, AuthTypeMini, AuthTypeWXNative, AuthTypeWxApp, AuthTypeWxAppCaishi}, wxUserinfo.OpenID, wxUserinfo.UnionID, wxUserinfo); err == nil {
authBindEx.UserHint = &auth2.UserBasic{