use last_eval_time for filter

This commit is contained in:
Ulric Qin 2021-12-11 18:14:23 +08:00
parent 7f0877bf28
commit d5050338f3
1 changed files with 2 additions and 2 deletions

View File

@ -87,7 +87,7 @@ func (e *AlertHisEvent) FillNotifyGroups(cache map[int64]*UserGroup) error {
} }
func AlertHisEventTotal(bgid, stime, etime int64, severity int, recovered int, clusters []string, query string) (int64, error) { func AlertHisEventTotal(bgid, stime, etime int64, severity int, recovered int, clusters []string, query string) (int64, error) {
session := DB().Model(&AlertHisEvent{}).Where("trigger_time between ? and ? and group_id = ?", stime, etime, bgid) session := DB().Model(&AlertHisEvent{}).Where("last_eval_time between ? and ? and group_id = ?", stime, etime, bgid)
if severity >= 0 { if severity >= 0 {
session = session.Where("severity = ?", severity) session = session.Where("severity = ?", severity)
@ -113,7 +113,7 @@ func AlertHisEventTotal(bgid, stime, etime int64, severity int, recovered int, c
} }
func AlertHisEventGets(bgid, stime, etime int64, severity int, recovered int, clusters []string, query string, limit, offset int) ([]AlertHisEvent, error) { func AlertHisEventGets(bgid, stime, etime int64, severity int, recovered int, clusters []string, query string, limit, offset int) ([]AlertHisEvent, error) {
session := DB().Where("trigger_time between ? and ? and group_id = ?", stime, etime, bgid) session := DB().Where("last_eval_time between ? and ? and group_id = ?", stime, etime, bgid)
if severity >= 0 { if severity >= 0 {
session = session.Where("severity = ?", severity) session = session.Where("severity = ?", severity)