- auth1与auth2以为是兼容

This commit is contained in:
gazebo
2019-08-26 15:16:05 +08:00
parent fcc87c34af
commit 20c63e7f59
11 changed files with 79 additions and 25 deletions

View File

@@ -87,7 +87,8 @@ var (
func GetWeixinOpenIDsFromStoreID(storeID int) (retVal []string) {
db := dao.GetDB()
if !globals.EnableWXAuth2 {
openIDMap := make(map[string]int)
if !globals.DisableWXAuth1 {
var openIDList []string
sql := `
SELECT openid
@@ -111,17 +112,20 @@ func GetWeixinOpenIDsFromStoreID(storeID int) (retVal []string) {
return retVal
}
for _, v := range openIDList {
retVal = append(retVal, v)
openIDMap[v] = 1
}
} else {
}
if globals.EnableWXAuth2 {
if userIDList, err2 := api2.RoleMan.GetRoleUserList(autils.NewRole(authz.StoreRoleBoss, storeID)); err2 == nil {
for _, v := range userIDList {
if authInfo, err2 := dao.GetAuthBind(db, v, weixin.AuthTypeMP, ""); err2 == nil {
retVal = append(retVal, authInfo.AuthID)
openIDMap[authInfo.AuthID] = 1
}
}
}
}
retVal = jxutils.StringMap2List(openIDMap)
if !globals.ReallyCallPlatformAPI {
// todo调试只发给我
globals.SugarLogger.Debugf("GetWeixinOpenIDsFromStoreID store:%d, openids:%v", storeID, retVal)