- auth1与auth2以为是兼容
This commit is contained in:
@@ -423,7 +423,7 @@ func Strings2Objs(strAndObjAddPairs ...interface{}) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func HandleUserWXRemark(db *dao.DaoDB, mobile string) (err error) {
|
||||
func HandleUserWXRemark(db *dao.DaoDB, mobile string, mobileIsUerID bool) (err error) {
|
||||
if db == nil {
|
||||
db = dao.GetDB()
|
||||
}
|
||||
@@ -438,9 +438,16 @@ func HandleUserWXRemark(db *dao.DaoDB, mobile string) (err error) {
|
||||
storeID = wxinfo.JxStoreID
|
||||
}
|
||||
} else {
|
||||
userList, _, err2 := dao.GetUsers(db, model.UserTypeStoreBoss, "", nil, "", mobile, 0, -1)
|
||||
if err = err2; len(userList) > 0 {
|
||||
userID := userList[0].GetID()
|
||||
userID := ""
|
||||
if mobileIsUerID {
|
||||
userID = mobile
|
||||
} else {
|
||||
userList, _, err2 := dao.GetUsers(db, model.UserTypeStoreBoss, "", nil, "", mobile, 0, -1)
|
||||
if err = err2; len(userList) > 0 {
|
||||
userID = userList[0].GetID()
|
||||
}
|
||||
}
|
||||
if userID != "" {
|
||||
authBind, err2 := dao.GetAuthBind(db, userID, weixin.AuthTypeMP, "")
|
||||
if err = err2; err == nil {
|
||||
openID = authBind.AuthID
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user