Browse Source

no message

xingzai 4 months ago
parent
commit
444229b8ca
2 changed files with 17 additions and 3 deletions
  1. 15 1
      models/wx_template_msg.go
  2. 2 2
      services/wechat_send_msg.go

+ 15 - 1
models/wx_template_msg.go

@@ -3,6 +3,7 @@ package models
 import (
 	"github.com/beego/beego/v2/client/orm"
 	"hongze/hongze_cygx/utils"
+	"strings"
 )
 
 type SendTemplateResponse struct {
@@ -31,10 +32,23 @@ func GetOpenIdList() (items []*OpenIdList, err error) {
 }
 
 func GetWxOpenIdByMobileList(mobile string) (items []*OpenIdList, err error) {
+	sliceMobile := strings.Split(mobile, ",")
+	var mobiles []string
+	for _, v := range sliceMobile {
+		mobiles = append(mobiles, v)
+	}
+	lenarr := len(mobiles)
+	if lenarr == 0 {
+		return
+	}
+	var condition string
+	var pars []interface{}
+	condition = ` AND u.cygx_bind_account IN (` + utils.GetOrmInReplace(lenarr) + `)`
+	pars = append(pars, mobiles)
 	sql := ` SELECT
 				union_id,open_id,
 				cygx_user_id AS user_id
-				FROM cygx_user_record	WHERE	1 = 1	AND cygx_bind_account IN (` + mobile + `)`
+				FROM cygx_user_record	WHERE	1 = 1	 ` + condition
 	_, err = orm.NewOrm().Raw(sql).QueryRows(&items)
 	return
 }

+ 2 - 2
services/wechat_send_msg.go

@@ -58,7 +58,7 @@ func SendInterviewApplyTemplateMsg(realName, companyName, mobile, articleTitle s
 func SendInterviewApplyCancelTemplateMsg(realName, companyName, mobile, articleTitle string, itemOpenid *models.OpenIdList) (err error) {
 	defer func() {
 		if err != nil {
-			go utils.SendAlarmMsg(fmt.Sprint("访谈申请取消模板消息推送消息失败,手机号", mobile, "公司:", companyName, "手机号:", mobile), 2)
+			go utils.SendAlarmMsg(fmt.Sprint("访谈申请取消模板消息推送消息失败,手机号", mobile, "公司:", companyName, "手机号:", mobile, ";Err:"+err.Error()), 2)
 		}
 	}()
 
@@ -87,7 +87,7 @@ func SendInterviewApplyCancelTemplateMsg(realName, companyName, mobile, articleT
 func SendPermissionApplyTemplateMsg(realName, companyName, mobile, applyMethod, redirectUrl string, user *models.WxUserItem) (err error) {
 	defer func() {
 		if err != nil {
-			go utils.SendAlarmMsg(fmt.Sprint("权限申请模板消息推送消息失败,手机号", mobile, "公司:", companyName, "手机号:", mobile), 2)
+			go utils.SendAlarmMsg(fmt.Sprint("权限申请模板消息推送消息失败,手机号", mobile, "公司:", companyName, ";Err:"+err.Error()), 2)
 		}
 	}()
 	companyId := user.CompanyId