@@ -25,7 +25,7 @@ func (c *MainController) Get() {
2525
2626//test page
2727func (c * MainController ) Test () {
28- if ! checkAccount (c .Ctx ) {
28+ if ! checkAccount (c .Ctx ) {
2929 c .Redirect ("/login" , 302 )
3030 return
3131 }
@@ -36,7 +36,7 @@ func (c *MainController) Test() {
3636
3737//template page
3838func (c * MainController ) Template () {
39- if ! checkAccount (c .Ctx ) {
39+ if ! checkAccount (c .Ctx ) {
4040 c .Redirect ("/login" , 302 )
4141 return
4242 }
@@ -52,7 +52,7 @@ func (c *MainController) Template() {
5252
5353//template add
5454func (c * MainController ) TemplateAdd () {
55- if ! checkAccount (c .Ctx ) {
55+ if ! checkAccount (c .Ctx ) {
5656 c .Redirect ("/login" , 302 )
5757 return
5858 }
@@ -84,7 +84,7 @@ func (c *MainController) AddTpl() {
8484 c .ServeJSON ()
8585}
8686func (c * MainController ) TemplateEdit () {
87- if ! checkAccount (c .Ctx ) {
87+ if ! checkAccount (c .Ctx ) {
8888 c .Redirect ("/login" , 302 )
8989 return
9090 }
@@ -110,7 +110,7 @@ func (c *MainController) TemplateEdit() {
110110// c.Data["Template"] = Template
111111//}
112112func (c * MainController ) TemplateDel () {
113- if ! checkAccount (c .Ctx ) {
113+ if ! checkAccount (c .Ctx ) {
114114 c .Redirect ("/login" , 302 )
115115 return
116116 }
@@ -139,15 +139,15 @@ func (c *MainController) AlertTest() {
139139 switch MessageData {
140140 case "wx" :
141141 wxtext := "[PrometheusAlert](https://github.com/feiyu563/PrometheusAlert)\n >**测试告警**\n >`告警级别:`测试\n **PrometheusAlert**"
142- ret := PostToWeiXin (wxtext , beego .AppConfig .String ("wxurl" ), "jikun.zhang" ,logsign )
142+ ret := PostToWeiXin (wxtext , beego .AppConfig .String ("wxurl" ), "jikun.zhang" , logsign )
143143 c .Data ["json" ] = ret
144144 case "dd" :
145145 ddtext := "## [PrometheusAlert](https://github.com/feiyu563/PrometheusAlert)\n \n " + "#### 测试告警\n \n " + "###### 告警级别:测试\n \n ##### PrometheusAlert\n \n " + " + ")"
146- ret := PostToDingDing ("PrometheusAlert" , ddtext , beego .AppConfig .String ("ddurl" ),"15395105573" , logsign )
146+ ret := PostToDingDing ("PrometheusAlert" , ddtext , beego .AppConfig .String ("ddurl" ), "15395105573" , logsign )
147147 c .Data ["json" ] = ret
148148 case "fs" :
149149 fstext := "[PrometheusAlert](https://github.com/feiyu563/PrometheusAlert)\n \n " + "测试告警\n \n " + "告警级别:测试\n \n PrometheusAlert\n \n " + " + ")"
150- ret := PostToFS ("PrometheusAlert" , fstext , beego .AppConfig .String ("fsurl" ), "244217140@qq.com" ,logsign )
150+ ret := PostToFS ("PrometheusAlert" , fstext , beego .AppConfig .String ("fsurl" ), "244217140@qq.com" , logsign )
151151 c .Data ["json" ] = ret
152152 case "txdx" :
153153 MobileMessage := "PrometheusAlertCenter测试告警"
@@ -193,15 +193,19 @@ func (c *MainController) AlertTest() {
193193 c .Data ["json" ] = ret
194194 case "workwechat" :
195195 WorkwechatMessage := "[PrometheusAlert](https://github.com/feiyu563/PrometheusAlert)\n " + "测试告警\n " + "告警级别:测试\n PrometheusAlert\n " + " + ")"
196- ret := SendWorkWechat (beego .AppConfig .String ("WorkWechat_ToUser" ),beego .AppConfig .String ("WorkWechat_ToParty" ), beego .AppConfig .String ("WorkWechat_ToTag" ),WorkwechatMessage , logsign )
196+ ret := SendWorkWechat (beego .AppConfig .String ("WorkWechat_ToUser" ), beego .AppConfig .String ("WorkWechat_ToParty" ), beego .AppConfig .String ("WorkWechat_ToTag" ), WorkwechatMessage , logsign )
197197 c .Data ["json" ] = ret
198198 case "bddx" :
199199 MobileMessage := "PrometheusAlertCenter测试告警"
200200 ret := PostBDYmessage (MobileMessage , beego .AppConfig .String ("defaultphone" ), logsign )
201201 c .Data ["json" ] = ret
202202 case "bdrl" :
203203 RLMessage := "## [PrometheusAlert](https://github.com/feiyu563/PrometheusAlert)\n \n " + "#### 测试告警\n \n " + "###### 告警级别:测试\n \n ##### PrometheusAlert\n \n " + " + ")"
204- ret := PostToRuLiu (beego .AppConfig .String ("BDRL_ID" ),RLMessage ,beego .AppConfig .String ("BDRL_URL" ), logsign )
204+ ret := PostToRuLiu (beego .AppConfig .String ("BDRL_ID" ), RLMessage , beego .AppConfig .String ("BDRL_URL" ), logsign )
205+ c .Data ["json" ] = ret
206+ case "bark" :
207+ TgMessage := "PrometheusAlertCenter测试告警"
208+ ret := SendBark (TgMessage , logsign )
205209 c .Data ["json" ] = ret
206210 default :
207211 c .Data ["json" ] = "hahaha!"
0 commit comments