feat: add custom webhook message

This commit is contained in:
engigu
2024-01-07 00:25:35 +08:00
parent e4a1b16e78
commit cf77fac836
18 changed files with 180 additions and 22 deletions
+10 -2
View File
@@ -47,12 +47,12 @@ func (sm *SendMessageService) Send() string {
errStr := ""
sm.LogsAndStatusMark(fmt.Sprintf("开始任务[%s]的发送", sm.TaskID), sm.Status)
sm.LogsAndStatusMark(fmt.Sprintf("发送标题:%s \n", sm.Title), sm.Status)
sendTaskService := send_task_service.SendTaskService{
ID: sm.TaskID,
}
task, err := sendTaskService.GetTaskWithIns()
sm.LogsAndStatusMark(fmt.Sprintf("任务名称:%s", task.Name), sm.Status)
sm.LogsAndStatusMark(fmt.Sprintf("发送标题:%s \n", sm.Title), sm.Status)
if err != nil {
errStr = fmt.Sprintf("任务[%s]不存在!退出发送!", sm.TaskID)
sm.LogsAndStatusMark(errStr, SendFail)
@@ -109,6 +109,14 @@ func (sm *SendMessageService) Send() string {
sm.LogsAndStatusMark(sm.TransError(errMsg), errStrIsSuccess(errMsg))
continue
}
// 自定义webhook类型的实例发送
customAuth, ok := msgObj.(send_way_service.WayDetailCustom)
if ok {
cs := CustomService{}
errMsg := cs.SendCustomMessage(customAuth, ins.SendTasksIns, typeC, sm.Title, content)
sm.LogsAndStatusMark(sm.TransError(errMsg), errStrIsSuccess(errMsg))
continue
}
sm.LogsAndStatusMark(fmt.Sprintf("发送失败:未知渠道的发信实例: %s\n", ins.ID), SendFail)
}