From e66e0d68d79d4253949fbc0dafe4ef213aa110ad 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, 2 Apr 2021 15:56:59 +0800 Subject: [PATCH] aa --- business/auth2/auth2.go | 4 ++-- business/auth2/authprovider/defauther.go | 2 +- business/jxstore/cms/user2.go | 4 ++-- business/jxutils/weixinmsg/weixinmsg.go | 4 ++-- business/model/dao/dao_auth2.go | 8 ++++---- business/partner/purchase/jx/localjx/order.go | 16 ++++++++-------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 44fa30ff9..c1d551009 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -283,7 +283,7 @@ func LoginInternal(ctx *Context, authType, authID, authIDType, authSecret string appID := strings.Split(authSecret, ",")[0] if appID == "wx08a5c2a8581414ff" || appID == "wx2d6949f724b2541d" || appID == "wx18111a41fd17f24f" || appID == "wx4b5930c13f8b1170" { //菜市或者果园 if user != nil { - binds, err := dao.GetUserBindAuthInfo(dao.GetDB(), user.GetID(), 0, nil, "", "", "wx2bb99eb5d2c9b82c") + binds, err := dao.GetUserBindAuthInfo(dao.GetDB(), user.GetID(), 0, nil, "", "", []string{"wx2bb99eb5d2c9b82c", "wx4b5930c13f8b1170"}) if err != nil { return authInfo, err } @@ -467,7 +467,7 @@ func DisableUser(userID, operatorUserName string) (err error) { } func GetUserBindAuthInfo(userID string) (authList []*model.AuthBind, err error) { - return dao.GetUserBindAuthInfo(dao.GetDB(), userID, model.AuthBindTypeAuth, nil, "", "", "") + return dao.GetUserBindAuthInfo(dao.GetDB(), userID, model.AuthBindTypeAuth, nil, "", "", nil) } func DeletedTokenInfoWithoutParam(authInfo *AuthInfo) (err error) { diff --git a/business/auth2/authprovider/defauther.go b/business/auth2/authprovider/defauther.go index 510a0c17c..4450ce156 100644 --- a/business/auth2/authprovider/defauther.go +++ b/business/auth2/authprovider/defauther.go @@ -82,7 +82,7 @@ func (a *DefAuther) UnionFindAuthBind(curAuthType, curAuthTypeID string, unionAu } else if dao.IsNoRowsError(err) { // 直接找不到,尝试unionID if unionID != "" { // 且有unionID var authBindList []*model.AuthBind - if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, "", unionID, ""); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式 + if authBindList, err = dao.GetUserBindAuthInfo(db, "", model.AuthBindTypeAuth, unionAuthTypeList, "", unionID, nil); err == nil && len(authBindList) > 0 { // 通过unionID找到至少一个认证方式 authBind = authBindList[0] authBind.Type = curAuthType authBind.TypeID = curAuthTypeID diff --git a/business/jxstore/cms/user2.go b/business/jxstore/cms/user2.go index a7a920c4f..bd5adacce 100644 --- a/business/jxstore/cms/user2.go +++ b/business/jxstore/cms/user2.go @@ -836,7 +836,7 @@ func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err e } } if userID != "" { - authBindList, err2 := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", "", "") + authBindList, err2 := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", "", nil) if err = err2; err == nil { for _, v := range authBindList { openIDs = append(openIDs, v.AuthID) @@ -1004,7 +1004,7 @@ func WriteToExcelJd(task *tasksch.SeqTask, jd []JdUserStruct) (err error) { func UpdateUserWxNoAndPercent(user *model.User, isReceiver bool) (num int64, err error) { db := dao.GetDB() user2, err := dao.GetUserByID(db, "user_id", user.UserID) - auth, err := dao.GetUserBindAuthInfo(db, user.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", "wx4b5930c13f8b1170") + auth, err := dao.GetUserBindAuthInfo(db, user.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", []string{"wx4b5930c13f8b1170"}) if len(auth) == 0 { return 0, fmt.Errorf("未找到此用户的微信验证方式!用户ID:[%v]\n", user.UserID) } diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index 4a39bc1a0..cbef4d31c 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -106,7 +106,7 @@ func GetWeixinOpenIDsFromStoreID(storeID int) (retVal []string) { if globals.EnableWXAuth2 { if userIDList, err2 := api2.RoleMan.GetRoleUserList(autils.NewStoreBossRole(storeID)); err2 == nil { for _, v := range userIDList { - if authList, err2 := dao.GetUserBindAuthInfo(db, v, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", "", ""); err2 == nil { + if authList, err2 := dao.GetUserBindAuthInfo(db, v, model.AuthBindTypeAuth, []string{weixin.AuthTypeMP}, "", "", nil); err2 == nil { for _, v := range authList { retVal = append(retVal, v.AuthID) openIDMap[v.AuthID] = 1 @@ -999,7 +999,7 @@ func NotifyUserMessage(userID string, title, content string) (err error) { func SendMsgToUser(userID string, templateID string, data interface{}) (err error) { globals.SugarLogger.Debugf("SendMsgToUser userID:%d, templateID:%s", userID, templateID) - authBinds, err := dao.GetUserBindAuthInfo(dao.GetDB(), userID, model.AuthBindTypeAuth, []string{"weixinsns"}, "", "", "wx2bb99eb5d2c9b82c") + authBinds, err := dao.GetUserBindAuthInfo(dao.GetDB(), userID, model.AuthBindTypeAuth, []string{"weixinsns"}, "", "", []string{"wx2bb99eb5d2c9b82c"}) if err != nil { return err } diff --git a/business/model/dao/dao_auth2.go b/business/model/dao/dao_auth2.go index 24f876168..e45d0010b 100644 --- a/business/model/dao/dao_auth2.go +++ b/business/model/dao/dao_auth2.go @@ -27,7 +27,7 @@ func GetAuthBind(db *DaoDB, bindType int, authType, authID string) (authBind *mo return authBind, err } -func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []string, authID, authID2, typeID string) (authList []*model.AuthBind, err error) { +func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []string, authID, authID2 string, typeIDs []string) (authList []*model.AuthBind, err error) { sql := ` SELECT * FROM auth_bind t1 @@ -56,9 +56,9 @@ func GetUserBindAuthInfo(db *DaoDB, userID string, bindType int, typeList []stri sql += " AND t1.auth_id2 = ?" sqlParams = append(sqlParams, authID2) } - if typeID != "" { - sql += " AND t1.type_id = ?" - sqlParams = append(sqlParams, typeID) + if len(typeIDs) > 0 { + sql += " AND t1.type IN (" + GenQuestionMarks(len(typeIDs)) + ")" + sqlParams = append(sqlParams, typeIDs) } sql += " ORDER BY t1.type" err = GetRows(db, &authList, sql, sqlParams...) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 9ffb5fa8f..f308a44d9 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -1503,7 +1503,7 @@ func PayForPopluarMan(ctx *jxcontext.Context, vendorOrderID, userID string, pric if user == nil { return fmt.Errorf("未找到此用户!用户ID:[%v]\n", userID) } - auth, err := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", "wx4b5930c13f8b1170") + auth, err := dao.GetUserBindAuthInfo(db, userID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", []string{"wx4b5930c13f8b1170"}) if len(auth) == 0 { return fmt.Errorf("未找到此用户的微信验证方式!用户ID:[%v]\n", userID) } @@ -1549,7 +1549,7 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context) (err error) { return err } user2, err := dao.GetUserByID(db, "mobile", user.ParentMobile) - auths, err := dao.GetUserBindAuthInfo(db, user2.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", "wx4b5930c13f8b1170") + auths, err := dao.GetUserBindAuthInfo(db, user2.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", []string{"wx4b5930c13f8b1170"}) if err != nil { return err } @@ -1577,7 +1577,7 @@ func AutoPayForPopluarMan(ctx *jxcontext.Context) (err error) { } if user2.ParentMobile != "" { user3, err := dao.GetUserByID(db, "mobile", user2.ParentMobile) - auths, err := dao.GetUserBindAuthInfo(db, user3.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", "wx4b5930c13f8b1170") + auths, err := dao.GetUserBindAuthInfo(db, user3.UserID, model.AuthBindTypeAuth, []string{"weixinmini"}, "", "", []string{"wx4b5930c13f8b1170"}) if err != nil { return err } @@ -1728,7 +1728,7 @@ func RefreshAllMatterOrderStatus(ctx *jxcontext.Context) (err error) { } if len(queryOrderStatus.OrderStatusList) > 0 { if queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode == jdeclpapi.SoStatusCode10034 { - txDB , _ := dao.Begin(db) + txDB, _ := dao.Begin(db) defer func() { if r := recover(); r != nil { dao.Rollback(db, txDB) @@ -1755,7 +1755,7 @@ func RefreshAllMatterOrderStatus(ctx *jxcontext.Context) (err error) { } } if len(goodsList2) > 0 { - txDB , _ := dao.Begin(db) + txDB, _ := dao.Begin(db) defer func() { if r := recover(); r != nil { dao.Rollback(db, txDB) @@ -1844,7 +1844,7 @@ func GetMatterOrderStatus(ctx *jxcontext.Context, vendorOrderID string) (result func updateMatterOrderStatus(db *dao.DaoDB, order *model.GoodsOrder, queryOrderStatus *jdeclpapi.QueryOrderStatusResult) { code := queryOrderStatus.OrderStatusList[len(queryOrderStatus.OrderStatusList)-1].SoStatusCode if code == jdeclpapi.SoStatusCode10034 || code == jdeclpapi.SoStatusCode10038 { - txDB , _ := dao.Begin(db) + txDB, _ := dao.Begin(db) defer func() { if r := recover(); r != nil { dao.Rollback(db, txDB) @@ -2330,7 +2330,7 @@ func UpdateCoupons(ctx *jxcontext.Context, payload map[string]interface{}, store } else { valid := dao.StrictMakeMapByStructObject(payload, coupons, ctx.GetUserName()) if len(valid) > 0 { - txDB , _ := dao.Begin(db) + txDB, _ := dao.Begin(db) defer func() { if r := recover(); r != nil { dao.Rollback(db, txDB) @@ -2481,7 +2481,7 @@ func CreateStoreAcctOrder(ctx *jxcontext.Context, orderType, storeID, price int, GoodsVendorOrderID: goodsVendorOrderID, } dao.WrapAddIDCULEntity(order, ctx.GetUserName()) - txDB , _ := dao.Begin(db) + txDB, _ := dao.Begin(db) defer func() { if r := recover(); r != nil { dao.Rollback(db, txDB)