异常通知

This commit is contained in:
李子铭 2025-03-20 10:32:47 +08:00
parent c00d947678
commit ec15531eac
3 changed files with 6 additions and 6 deletions

View File

@ -3,5 +3,5 @@ package mixrepos
import "context"
type DingMixRepo interface {
SendMarkdownMessage(ctx context.Context, text string) error
SendMarkdownMessage(ctx context.Context, title, text string) error
}

View File

@ -205,12 +205,12 @@ func (v *VoucherBiz) alarm(ctx context.Context, order *bo.OrderBo, errMsg string
return fmt.Errorf(fmt.Sprintf("alarm 二次获取redis缓存%s异常:%v", c.Key, err))
}
if cacheValue != "" {
if len(cacheValue) > 0 {
return nil // 有直接返回
}
// 通知
if err = v.DingMixRepo.SendMarkdownMessage(ctx, v.alarmText(ctx, order, errMsg)); err != nil {
if err = v.DingMixRepo.SendMarkdownMessage(ctx, "异常通知", v.alarmText(ctx, order, errMsg)); err != nil {
return err
}

View File

@ -20,15 +20,15 @@ func NewDingMixRepoImpl(bc *conf.Bootstrap) mixrepos.DingMixRepo {
return &DingMixRepoImpl{bc: bc, client: client}
}
func (s *DingMixRepoImpl) SendMarkdownMessage(_ context.Context, text string) error {
func (s *DingMixRepoImpl) SendMarkdownMessage(_ context.Context, title, text string) error {
isAtAll := false
if len(s.bc.Alarm.AtMobiles) == 0 {
isAtAll = true
}
if err := s.client.SendMarkdownMessage("xx", text, s.bc.Alarm.AtMobiles, isAtAll); err != nil {
return fmt.Errorf("Markdown 消息发送失败: %v", err)
if err := s.client.SendMarkdownMessage(title, text, s.bc.Alarm.AtMobiles, isAtAll); err != nil {
return fmt.Errorf("markdown 消息发送失败: %v", err)
}
return nil