| 42 | } |
| 43 | |
| 44 | func UpdateAlertRouter(id int, tplid int, name, rules, url_or_phone, at_some_one string, at_some_one_rr bool, sendResolved bool) error { |
| 45 | tpl, _ := GetTpl(tplid) |
| 46 | o := orm.NewOrm() |
| 47 | router_update := &AlertRouter{Id: id} |
| 48 | err := o.Read(router_update) |
| 49 | if err == nil { |
| 50 | router_update.Id = id |
| 51 | router_update.Name = name |
| 52 | router_update.Tpl = tpl |
| 53 | router_update.Rules = rules |
| 54 | router_update.UrlOrPhone = url_or_phone |
| 55 | router_update.AtSomeOne = at_some_one |
| 56 | router_update.AtSomeOneRR = at_some_one_rr |
| 57 | router_update.SendResolved = sendResolved |
| 58 | router_update.Created = time.Now() |
| 59 | _, err := o.Update(router_update) |
| 60 | return err |
| 61 | } |
| 62 | return err |
| 63 | } |
| 64 | |
| 65 | func DelAlertRouter(id int) error { |
| 66 | o := orm.NewOrm() |