|
@@ -658,3 +658,38 @@ func SendActivityOnenIdWxTemplateMsg(first, keyWord1, keyWord2, keyWord3, keyWor
|
|
|
WxSendTemplateMsg(sendUrl, sendMap, openIdList, "", utils.TEMPLATE_MSG_CYGX_ARTICLE_ADD)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+//发送用户留言提醒
|
|
|
+func SendCommentWxTemplateMsg(keyWord1, keyWord2 string, openIdList []*models.OpenIdList, articleId int) (err error) {
|
|
|
+ var msg string
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ go utils.SendEmail("发送模版消息失败"+"【"+utils.APPNAME+"】"+time.Now().Format("2006-01-02 15:04:05"), msg+";Err:"+err.Error(), utils.EmailSendToUsers)
|
|
|
+ go utils.SendAlarmMsg(fmt.Sprint("发送用户用户留言提醒,文章ID:", articleId), 2)
|
|
|
+ utils.FileLog.Info("发送模版消息失败,Err:%s", err.Error())
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ accessToken, err := models.GetWxAccessTokenByXzs()
|
|
|
+ if err != nil {
|
|
|
+ msg = "GetWxAccessToken Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if accessToken == "" {
|
|
|
+ msg = "accessToken is empty"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var first string
|
|
|
+ first = keyWord1
|
|
|
+ keyword1 := keyWord2
|
|
|
+ sendUrl := "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken
|
|
|
+ templateId := utils.WxMsgTemplateIdArticleUserRemind
|
|
|
+ sendMap := make(map[string]interface{})
|
|
|
+ sendData := make(map[string]interface{})
|
|
|
+ sendMap["template_id"] = templateId
|
|
|
+ sendMap["miniprogram"] = map[string]interface{}{"appid": utils.WxAppId, "pagepath": "activityPages/specialDetail/specialDetail?id=" + strconv.Itoa(articleId)}
|
|
|
+ sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"}
|
|
|
+ sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"}
|
|
|
+ sendMap["data"] = sendData
|
|
|
+ WxSendTemplateMsg(sendUrl, sendMap, openIdList, strconv.Itoa(articleId), utils.TEMPLATE_MSG_CYGX_ARTICLE_ADD)
|
|
|
+ return
|
|
|
+}
|