fix send ByAll

This commit is contained in:
MyronZhang
2025-02-11 18:32:59 +08:00
parent 8f6b13c2fe
commit a78360efd8
2 changed files with 9 additions and 3 deletions

View File

@@ -12,12 +12,18 @@ const (
)
func Notify(by string, title string, description string, content string) error {
if by == ByAll {
var errMsgs []string
if err := SendEmail(title, config.RootUserEmail, content); err != nil {
return fmt.Errorf("failed to send email: %v", err)
errMsgs = append(errMsgs, fmt.Sprintf("failed to send email: %v", err))
}
if err := SendMessage(title, description, content); err != nil {
return fmt.Errorf("failed to send message: %v", err)
errMsgs = append(errMsgs, fmt.Sprintf("failed to send message: %v", err))
}
if len(errMsgs) > 0 {
return fmt.Errorf("multiple errors occurred: %v", errMsgs)
}
return nil
}