feat: add wehchat template message push

This commit is contained in:
engigu
2024-03-05 14:42:12 +08:00
parent 32c1c8ad76
commit 4388d08109
16 changed files with 277 additions and 24 deletions
@@ -28,6 +28,7 @@ type SendMessageService struct {
Title string
Text string
HTML string
URL string
MarkDown string
CallerIp string
@@ -184,6 +185,15 @@ func (sm *SendMessageService) Send(task models.TaskIns) (string, error) {
sm.LogsAndStatusMark(sm.TransError(errMsg), errStrIsSuccess(errMsg))
continue
}
// 微信公众号模板消息的实例发送
wca, ok := msgObj.(send_way_service.WeChatOFAccount)
if ok {
cs := WeChatOfAccountService{}
res, errMsg := cs.SendWeChatOfAccountMessage(wca, ins.SendTasksIns, typeC, sm.Title, content, sm.URL)
sm.LogsAndStatusMark(fmt.Sprintf("返回内容:%s", res), sm.Status)
sm.LogsAndStatusMark(sm.TransError(errMsg), errStrIsSuccess(errMsg))
continue
}
sm.LogsAndStatusMark(fmt.Sprintf("发送失败:未知渠道的发信实例: %s\n", ins.ID), SendFail)
}