From 853053f56d5e451420fb5891637e908ba18fb0df Mon Sep 17 00:00:00 2001 From: 710leo <710leo@gmail.com> Date: Fri, 30 Jul 2021 10:58:42 +0800 Subject: [PATCH] fix: alert rule put --- http/router_alert_rule.go | 7 +++++-- http/router_user_group.go | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/http/router_alert_rule.go b/http/router_alert_rule.go index c34e052f..4b691f27 100644 --- a/http/router_alert_rule.go +++ b/http/router_alert_rule.go @@ -47,7 +47,7 @@ func alertRuleAdd(c *gin.Context) { bind(c, &f) me := loginUser(c).MustPerm("alert_rule_create") - + var ids []int64 for _, alertRule := range f { arg := AlertRuleGroup(alertRule.GroupId) alertRuleWritePermCheck(arg, me) @@ -74,9 +74,10 @@ func alertRuleAdd(c *gin.Context) { UpdateBy: me.Username, } dangerous(ar.Add()) + ids = append(ids, ar.Id) } - renderMessage(c, nil) + renderData(c, ids, nil) } func alertRulePut(c *gin.Context) { @@ -90,6 +91,7 @@ func alertRulePut(c *gin.Context) { ar.Name = f.Name ar.Note = f.Note + ar.Type = f.Type ar.Status = f.Status ar.AlertDuration = f.AlertDuration ar.Expression = f.Expression @@ -111,6 +113,7 @@ func alertRulePut(c *gin.Context) { renderMessage(c, ar.Update( "name", "note", + "type", "status", "alert_duration", "expression", diff --git a/http/router_user_group.go b/http/router_user_group.go index d366e547..108ca3ea 100644 --- a/http/router_user_group.go +++ b/http/router_user_group.go @@ -55,7 +55,7 @@ func userGroupAdd(c *gin.Context) { // 顺便把创建者也作为团队的一员,失败了也没关系,用户会重新添加成员 models.UserGroupMemberAdd(ug.Id, me.Id) - renderMessage(c, nil) + renderData(c, ug.Id, nil) } func userGroupPut(c *gin.Context) { -- GitLab