diff --git a/pkg/notify/models/event_template.go b/pkg/notify/models/event_template.go index 26ab6ea4d1..aff3680622 100644 --- a/pkg/notify/models/event_template.go +++ b/pkg/notify/models/event_template.go @@ -193,7 +193,15 @@ func (lt *SLocalTemplateManager) fillWithTemplate(ctx context.Context, titleOrCo err error ) actionResultStr := event.ActionWithResult("_") - for _, topic := range []string{specTopic(event), event.StringWithDeli("_"), actionResultStr, "common"} { + topics := []string{specTopic(event), event.StringWithDeli("_"), actionResultStr} + if event.Result() == api.ResultFailed { + tempActionResourceArr := strings.Split(actionResultStr, "_") + if len(tempActionResourceArr) > 1 { + topics = append(topics, strings.Join(tempActionResourceArr[:len(tempActionResourceArr)-1], "_")) + } + } + topics = append(topics, "common") + for _, topic := range topics { if topic == "" { continue } @@ -574,11 +582,20 @@ func init() { "added to the recycle bin", "加入回收站", }, - + sI18nElme{ + string(api.ActionSyncUpdate), + "sync_create", + "同步新建", + }, sI18nElme{ string(api.ActionSyncUpdate), "sync_update", - "同步", + "同步更新", + }, + sI18nElme{ + string(api.ActionSyncUpdate), + "sync_delete", + "同步删除", }, sI18nElme{ string(api.ActionMigrate), diff --git a/pkg/notify/models/topic.go b/pkg/notify/models/topic.go index e23fe1da71..914a13deb3 100644 --- a/pkg/notify/models/topic.go +++ b/pkg/notify/models/topic.go @@ -328,7 +328,7 @@ func (sm *STopicManager) InitializeData() error { notify.ActionOffline, ) t.Type = notify.TOPIC_TYPE_RESOURCE - t.Results = tristate.True + t.Results = tristate.False case DefaultChecksumTestFailed: t.addResources( notify.TOPIC_RESOURCE_DB_TABLE_RECORD, diff --git a/pkg/notify/sender/feishu.go b/pkg/notify/sender/feishu.go index 6c832d2e5a..8cb5b57a93 100644 --- a/pkg/notify/sender/feishu.go +++ b/pkg/notify/sender/feishu.go @@ -53,6 +53,9 @@ func (feishuSender *SFeishuSender) Send(args api.SendParams) error { if err == nil { return nil } + if rep == nil { + return errors.Wrap(err, "feishu.sendRequest") + } // 发送通知失败的情况 code, err := rep.GetString("code") if err != nil { diff --git a/pkg/notify/sender/utils.go b/pkg/notify/sender/utils.go index 5110600fb9..641976cd21 100644 --- a/pkg/notify/sender/utils.go +++ b/pkg/notify/sender/utils.go @@ -47,9 +47,9 @@ func sendRequest(url string, method httputils.THttpMethod, header http.Header, p if params != nil { url += params.Encode() } - _, req, err := httputils.JSONRequest(cli, ctx, method, url, header, body, options.Options.DebugRequest) + _, resp, err := httputils.JSONRequest(cli, ctx, method, url, header, body, options.Options.DebugRequest) if err != nil { - return nil, utilerr.Wrap(err, "http request") + return resp, utilerr.Wrap(err, "http request") } - return req, nil + return resp, nil }