code refactor
This commit is contained in:
parent
0a29fb89c4
commit
562f3ea937
|
@ -185,7 +185,11 @@ func AlertEventTotal(stime, etime int64, query string, status, priority int) (nu
|
||||||
arr := strings.Fields(query)
|
arr := strings.Fields(query)
|
||||||
for i := 0; i < len(arr); i++ {
|
for i := 0; i < len(arr); i++ {
|
||||||
qarg := "%" + arr[i] + "%"
|
qarg := "%" + arr[i] + "%"
|
||||||
cond = cond.Or(builder.Like{"res_classpaths", qarg}, builder.Like{"rule_name", qarg}, builder.Like{"tags", qarg})
|
innerCond := builder.NewCond()
|
||||||
|
innerCond = innerCond.Or(builder.Like{"res_classpaths", qarg})
|
||||||
|
innerCond = innerCond.Or(builder.Like{"rule_name", qarg})
|
||||||
|
innerCond = innerCond.Or(builder.Like{"tags", qarg})
|
||||||
|
cond = cond.And(innerCond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,7 +220,11 @@ func AlertEventGets(stime, etime int64, query string, status, priority int, limi
|
||||||
arr := strings.Fields(query)
|
arr := strings.Fields(query)
|
||||||
for i := 0; i < len(arr); i++ {
|
for i := 0; i < len(arr); i++ {
|
||||||
qarg := "%" + arr[i] + "%"
|
qarg := "%" + arr[i] + "%"
|
||||||
cond = cond.Or(builder.Like{"res_classpaths", qarg}, builder.Like{"rule_name", qarg}, builder.Like{"tags", qarg})
|
innerCond := builder.NewCond()
|
||||||
|
innerCond = innerCond.Or(builder.Like{"res_classpaths", qarg})
|
||||||
|
innerCond = innerCond.Or(builder.Like{"rule_name", qarg})
|
||||||
|
innerCond = innerCond.Or(builder.Like{"tags", qarg})
|
||||||
|
cond = cond.And(innerCond)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue