alert event modify filling user detail

This commit is contained in:
710leo 2021-04-09 15:33:52 +08:00
parent 72573e32cb
commit 31a03aa331
3 changed files with 8 additions and 2 deletions

View File

@ -506,7 +506,7 @@ func (s *Stra) Decode() error {
return err
}
s.NotifyUserDetail, err = UserGets(s.NotifyUser, 10000, 0, "")
s.NotifyUserDetail, err = UserGetsByIds(s.NotifyUser)
if err != nil {
logger.Errorf("decode strategy(%d) on NotifyUserDetail fail: %v", s.Id, err)
return err

View File

@ -341,6 +341,12 @@ func UserTotal(ids []int64, where string, args ...interface{}) (int64, error) {
return session.Count(new(User))
}
func UserGetsByIds(ids []int64) ([]User, error) {
var users []User
err := DB["rdb"].In("id", ids).Find(&users)
return users, err
}
func UserGets(ids []int64, limit, offset int, where string, args ...interface{}) ([]User, error) {
session := DB["rdb"].Limit(limit, offset).OrderBy("username")
if len(ids) > 0 {

View File

@ -90,7 +90,7 @@ func (self StatsdReporter) handleActions(actions []action) {
switch action.actionType {
case "report":
previousState := StatsdState{}.RollState()
//previousState.Summarize() // 指标进一步聚合,得到类似<all>的tag值
previousState.Summarize() // 指标进一步聚合,得到类似<all>的tag值
// 第一个统计周期不准确, 扔掉
if isFirstPeriod {