Browse Source

no message

xingzai 1 year ago
parent
commit
95458a5819
1 changed files with 11 additions and 13 deletions
  1. 11 13
      services/cygx/cygx_yanxuan_special.go

+ 11 - 13
services/cygx/cygx_yanxuan_special.go

@@ -17,7 +17,7 @@ import (
 func SendWxMsgSpecialFollow(specialId int) (err error) {
 	defer func() {
 		if err != nil {
-			go alarm_msg.SendAlarmMsg(fmt.Sprint("研选专栏有新内容审核通过时,给关注此专栏的客户发送模板消息失败", specialId, ", specialId"), 2)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("研选专栏有新内容审核通过时,给关注此专栏的客户发送模板消息失败,specialId:", specialId, err.Error()), 2)
 
 		}
 	}()
@@ -33,7 +33,9 @@ func SendWxMsgSpecialFollow(specialId int) (err error) {
 		err = errors.New("GetYanxuanSpecialFollowUserById, Err: " + e.Error())
 		return
 	}
-
+	if len(followers) == 0 {
+		return
+	}
 	specialItem, e := cygx.GetYanxuanSpecialItemById(specialId)
 	if e != nil {
 		err = errors.New("GetYanxuanSpecialFollowUserById, Err: " + e.Error())
@@ -57,22 +59,18 @@ func SendWxMsgSpecialFollow(specialId int) (err error) {
 		mobile = append(mobile, v.Mobile)
 	}
 
-	//condition := ""
-	//pars := make([]interface{}, 0)
-	//condition += ` AND u.mobile IN (` + utils.GetOrmInReplace(len(mobile)) + `)`
-	//pars = append(pars, mobile)
-
 	openIdList, e := cygx.GetUserRecordListByMobileArr(mobile)
 	if e != nil {
 		err = errors.New("GetSellerByAdminId, Err: " + e.Error())
 		return
 	}
 
-	//first =
+	if len(openIdList) == 0 {
+		return
+	}
 	keyword1 = "研选专栏:" + specialItem.SpecialName
 	keyword2 = "发布了新内容,点击查看详情"
-	//keyword3 = "-"
-	//keyword4 = "【" + activityInfo.ResearchTheme + "】已有10人预报名"
+
 	openIdArr := make([]string, 0)
 	for _, v := range openIdList {
 		openIdArr = append(openIdArr, v.OpenId)
@@ -110,7 +108,7 @@ func SendWxMsgSpecialFollow(specialId int) (err error) {
 func SendWxMsgSpecialAuthor(specialId, status int) (err error) {
 	defer func() {
 		if err != nil {
-			go alarm_msg.SendAlarmMsg(fmt.Sprint("研选专栏审核完成时,给提交人发送模板消息", specialId, ", specialId"), 2)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("研选专栏审核完成时,给提交人发送模板消息 specialId:", specialId, err.Error()), 2)
 		}
 	}()
 	var first string
@@ -168,7 +166,7 @@ func SendWxMsgSpecialAuthor(specialId, status int) (err error) {
 	sendInfo.Keyword3 = keyword3
 	sendInfo.Keyword4 = keyword4
 	sendInfo.Remark = remark
-	sendInfo.TemplateId = utils.WxMsgTemplateIdAskByUser
+	sendInfo.TemplateId = utils.WxMsgTemplateIdActivityChangeApplyXzs
 	sendInfo.RedirectUrl = redirectUrl
 	sendInfo.RedirectTarget = 3
 	sendInfo.Resource = strconv.Itoa(specialId)
@@ -223,7 +221,7 @@ func UpdateYanxuanSpecialResourceData(sourceId int) {
 	var err error
 	defer func() {
 		if err != nil {
-			go alarm_msg.SendAlarmMsg(fmt.Sprint("更新研选专栏失败ourceId: ", sourceId), 2)
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("更新研选专栏失败ourceId: ", sourceId, err.Error()), 2)
 		}
 	}()
 	var source = utils.CYGX_OBJ_YANXUANSPECIAL