|
@@ -9,6 +9,7 @@ import (
|
|
|
"hongze/hongze_yb/global"
|
|
|
"hongze/hongze_yb/models/tables/user_record"
|
|
|
"hongze/hongze_yb/models/tables/user_template_record"
|
|
|
+ "hongze/hongze_yb/models/tables/wx_user"
|
|
|
"hongze/hongze_yb/services/alarm_msg"
|
|
|
"hongze/hongze_yb/utils"
|
|
|
"io/ioutil"
|
|
@@ -233,4 +234,47 @@ func SendQuestionReplyWxMsg(questionId, userId int, questionTitle string) (err e
|
|
|
}
|
|
|
err = SendMultiTemplateMsg(sendMap, openIdList, wxAppPath, utils.TEMPLATE_MSG_YB_COMMUNITY_QUESTION)
|
|
|
return
|
|
|
+}
|
|
|
+
|
|
|
+// SendVoiceBroadcastWxMsg 推送研报小程序模板消息-语音播报
|
|
|
+func SendVoiceBroadcastWxMsg(broadcastId int, sectionName, broadcastName string) (err error) {
|
|
|
+ var errMsg string
|
|
|
+ defer func() {
|
|
|
+ if err != nil {
|
|
|
+ alarmMsg := fmt.Sprintf("SendVoiceBroadcastWxMsg-推送语音播报模版消息失败; broadcastId: %d; Err: %s; Msg: %s", broadcastId, err.Error(), errMsg)
|
|
|
+ go alarm_msg.SendAlarmMsg(alarmMsg, 3)
|
|
|
+ }
|
|
|
+ }()
|
|
|
+
|
|
|
+ openIdList, err := wx_user.GetOpenIdList()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ sendMap := make(map[string]interface{})
|
|
|
+ sendData := make(map[string]interface{})
|
|
|
+
|
|
|
+ first := "您好,有新的语音播报待查看"
|
|
|
+ keyword1 := sectionName + ":" + broadcastName
|
|
|
+ keyword2 := "待查看"
|
|
|
+ remark := "请点击详情查看"
|
|
|
+
|
|
|
+ sendData["first"] = map[string]interface{}{"value": first, "color": "#173177"}
|
|
|
+ sendData["keyword1"] = map[string]interface{}{"value": keyword1, "color": "#173177"}
|
|
|
+ sendData["keyword2"] = map[string]interface{}{"value": keyword2, "color": "#173177"}
|
|
|
+ sendData["remark"] = map[string]interface{}{"value": remark, "color": "#173177"}
|
|
|
+
|
|
|
+ sendMap["template_id"] = TemplateIdWithCommunityQuestion
|
|
|
+ sendMap["data"] = sendData
|
|
|
+
|
|
|
+ wxAppPath := fmt.Sprintf("pages/voice/voice?voiceId=%d", broadcastId)
|
|
|
+ //if global.CONFIG.Serve.RunMode == "debug" {
|
|
|
+ // // 仅测试环境测试用
|
|
|
+ // wxAppPath = "pages/voice/voice?voiceId"
|
|
|
+ //}
|
|
|
+ if wxAppPath != "" {
|
|
|
+ sendMap["miniprogram"] = map[string]interface{}{"appid": WxYbAppId, "pagepath": wxAppPath}
|
|
|
+ }
|
|
|
+ err = SendMultiTemplateMsg(sendMap, openIdList, wxAppPath, utils.TEMPLATE_MSG_YB_VOICE_BROADCAST)
|
|
|
+ return
|
|
|
}
|