mirror of
https://github.com/songquanpeng/one-api.git
synced 2025-09-18 17:46:37 +08:00
fix send ByAll
This commit is contained in:
parent
8f6b13c2fe
commit
a78360efd8
@ -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
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ func testChannels(ctx context.Context, notify bool, scope string) error {
|
||||
if notify {
|
||||
err := message.Notify(message.ByAll, "渠道测试完成", "", "渠道测试完成,如果没有收到禁用通知,说明所有渠道都正常")
|
||||
if err != nil {
|
||||
logger.SysError(fmt.Sprintf("failed to send email: %s", err.Error()))
|
||||
logger.SysError(fmt.Sprintf("failed to send notify: %s", err.Error()))
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user