异常通知
This commit is contained in:
parent
c00d947678
commit
ec15531eac
|
|
@ -3,5 +3,5 @@ package mixrepos
|
||||||
import "context"
|
import "context"
|
||||||
|
|
||||||
type DingMixRepo interface {
|
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))
|
return fmt.Errorf(fmt.Sprintf("alarm 二次获取redis缓存%s异常:%v", c.Key, err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if cacheValue != "" {
|
if len(cacheValue) > 0 {
|
||||||
return nil // 有直接返回
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,15 +20,15 @@ func NewDingMixRepoImpl(bc *conf.Bootstrap) mixrepos.DingMixRepo {
|
||||||
return &DingMixRepoImpl{bc: bc, client: client}
|
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
|
isAtAll := false
|
||||||
if len(s.bc.Alarm.AtMobiles) == 0 {
|
if len(s.bc.Alarm.AtMobiles) == 0 {
|
||||||
isAtAll = true
|
isAtAll = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.client.SendMarkdownMessage("xx", text, s.bc.Alarm.AtMobiles, isAtAll); err != nil {
|
if err := s.client.SendMarkdownMessage(title, text, s.bc.Alarm.AtMobiles, isAtAll); err != nil {
|
||||||
return fmt.Errorf("Markdown 消息发送失败: %v", err)
|
return fmt.Errorf("markdown 消息发送失败: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue