异常通知
This commit is contained in:
parent
c00d947678
commit
ec15531eac
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue