Commit 0de4349f authored by 李科's avatar 李科

fix: 完善处置

parent 6b404ed5
......@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"github.com/jinzhu/copier"
json "github.com/json-iterator/go"
"github.com/olivere/elastic/v7"
"github.com/opensearch-project/opensearch-go/opensearchapi"
......@@ -15,11 +16,13 @@ import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/util"
"go.uber.org/zap"
"io"
"log"
"net/http"
"strings"
"time"
"xorm.io/xorm"
)
......@@ -404,9 +407,18 @@ func (a *AlertSvc) Update(req request.UpdateAlert) error {
func (a *AlertSvc) BatchPushAlert(session *xorm.Session, req request.BatchPushAlert) error {
now := jsontime.Now()
_ = now
data := entity.PushRecord{
CreatedBy: a.User.SystemAccount,
CreatedAt: now,
UpdatedBy: a.User.SystemAccount,
UpdatedAt: now,
}
_ = copier.Copy(&data, &req)
data.NotifyMethod = util.ConvertToString(req.NotifyMethod)
data.SystemAccount = util.ConvertToString(req.NotifyRecipients) // 循环查询
// TODO 批量推送用户告警
conf.Logger.Info("batch push", zap.Any("payload", req))
time.Sleep(time.Second)
return nil
}
......@@ -429,6 +441,7 @@ func (a *AlertSvc) BatchCloseAlert(req request.BatchCloseAlert) (err error) {
}
}
conf.Logger.Info("batch close", zap.Any("payload", req))
time.Sleep(time.Second)
return
}
......@@ -518,5 +531,6 @@ func (a *AlertSvc) DisposeAlert(req request.DisposeAlert) (err error) {
if err != nil {
return
}
time.Sleep(time.Second)
return nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment