Skip to content

Commit

Permalink
修复自定义模板接口无法获取手机号bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jikun.zhang committed Mar 2, 2021
1 parent 38e1e27 commit 763cf8b
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 7 deletions.
8 changes: 7 additions & 1 deletion controllers/prometheusalert.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (c *PrometheusAlertController) PrometheusAlert() {
P_wxurl := c.Input().Get("wxurl")
P_fsurl := c.Input().Get("fsurl")
P_phone := c.Input().Get("phone")
if P_phone == "" && P_type == "txdx" || P_type == "hwdx" || P_type == "bddx" || P_type == "alydx" || P_type == "txdh" || P_type == "alydh" || P_type == "rlydh" {
if P_phone == "" && ( P_type == "txdx" || P_type == "hwdx" || P_type == "bddx" || P_type == "alydx" || P_type == "txdh" || P_type == "alydh" || P_type == "rlydh" || P_type == "7moordx" || P_type == "7moordh") {
P_phone = GetUserPhone(1)
}
P_email := c.Input().Get("email")
Expand Down Expand Up @@ -111,6 +111,12 @@ func SendMessagePrometheusAlert(message, ptype, pddurl, pwxurl, pfsurl, pphone,
//容联云电话
case "rlydh":
ret = ret + PostRLYphonecall(message, pphone, logsign)
//七陌短信
case "7moordx":
ret = ret + Post7MOORmessage(message, pphone, logsign)
//七陌语音电话
case "7moordh":
ret = ret + Post7MOORphonecall(message, pphone, logsign)
//邮件
case "email":
ret = ret + SendEmail(message, email, logsign)
Expand Down
Binary file modified db/PrometheusAlertDB.db
Binary file not shown.
Binary file modified example/linux/PrometheusAlert
Binary file not shown.
2 changes: 2 additions & 0 deletions example/linux/views/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
{{if eq .Tpltype "hwdx"}}华为云短信{{end}}
{{if eq .Tpltype "bddx"}}百度云短信{{end}}
{{if eq .Tpltype "rlydh"}}容联云电话{{end}}
{{if eq .Tpltype "7moordx"}}七陌短信{{end}}
{{if eq .Tpltype "7moordh"}}七陌语音电话{{end}}
{{if eq .Tpltype "email"}}Email{{end}}
{{if eq .Tpltype "tg"}}Telegram{{end}}
{{if eq .Tpltype "rl"}}百度Hi(如流){{end}}
Expand Down
2 changes: 2 additions & 0 deletions example/linux/views/template_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<option value="hwdx">华为云短信</option>
<option value="bddx">百度云短信</option>
<option value="rlydh">容联云电话</option>
<option value="7moordx">七陌短信</option>
<option value="7moordh">七陌语音电话</option>
<option value="email">Email</option>
<option value="tg">Telegram</option>
<option value="rl">百度Hi(如流)</option>
Expand Down
4 changes: 3 additions & 1 deletion example/linux/views/template_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<option value="hwdx" {{if eq .Template.Tpltype "hwdx"}}selected="selected"{{end}}>华为云短信</option>
<option value="bddx" {{if eq .Template.Tpltype "bddx"}}selected="selected"{{end}}>百度云短信</option>
<option value="rlydh" {{if eq .Template.Tpltype "rlydh"}}selected="selected"{{end}}>容联云电话</option>
<option value="rlydh" {{if eq .Template.Tpltype "7moordx"}}selected="selected"{{end}}>七陌短信</option>
<option value="rlydh" {{if eq .Template.Tpltype "7moordh"}}selected="selected"{{end}}>七陌语音电话</option>
<option value="email" {{if eq .Template.Tpltype "email"}}selected="selected"{{end}}>Email</option>
<option value="tg" {{if eq .Template.Tpltype "tg"}}selected="selected"{{end}}>Telegram</option>
<option value="rl" {{if eq .Template.Tpltype "rl"}}selected="selected"{{end}}>百度Hi(如流)</option>
Expand All @@ -56,7 +58,7 @@
<option value="Grafana" {{if eq .Template.Tpluse "Grafana"}}selected="selected"{{end}}>Grafana</option>
<option value="SonarQube" {{if eq .Template.Tpluse "SonarQube"}}selected="selected"{{end}}>SonarQube</option>
<option value="Jenkins" {{if eq .Template.Tpluse "Jenkins"}}selected="selected"{{end}}>Jenkins</option>
<option value="SonarQube" {{if eq .Template.Tpluse "Other"}}selected="selected"{{end}}>Other</option>
<option value="Other" {{if eq .Template.Tpluse "Other"}}selected="selected"{{end}}>Other</option>
</select>
</div>
<br />
Expand Down
2 changes: 1 addition & 1 deletion example/linux/views/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</tr>

<tr>
<th>15</th>
<th>16</th>
<th>百度Hi(如流)</th>
<th><button class="btn btn-primary" data-toggle='modal' id="bdrl">告警测试</button></th>
</tr>
Expand Down
Binary file modified example/windows/PrometheusAlert.exe
Binary file not shown.
2 changes: 2 additions & 0 deletions example/windows/views/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
{{if eq .Tpltype "hwdx"}}华为云短信{{end}}
{{if eq .Tpltype "bddx"}}百度云短信{{end}}
{{if eq .Tpltype "rlydh"}}容联云电话{{end}}
{{if eq .Tpltype "7moordx"}}七陌短信{{end}}
{{if eq .Tpltype "7moordh"}}七陌语音电话{{end}}
{{if eq .Tpltype "email"}}Email{{end}}
{{if eq .Tpltype "tg"}}Telegram{{end}}
{{if eq .Tpltype "rl"}}百度Hi(如流){{end}}
Expand Down
2 changes: 2 additions & 0 deletions example/windows/views/template_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<option value="hwdx">华为云短信</option>
<option value="bddx">百度云短信</option>
<option value="rlydh">容联云电话</option>
<option value="7moordx">七陌短信</option>
<option value="7moordh">七陌语音电话</option>
<option value="email">Email</option>
<option value="tg">Telegram</option>
<option value="rl">百度Hi(如流)</option>
Expand Down
4 changes: 3 additions & 1 deletion example/windows/views/template_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<option value="hwdx" {{if eq .Template.Tpltype "hwdx"}}selected="selected"{{end}}>华为云短信</option>
<option value="bddx" {{if eq .Template.Tpltype "bddx"}}selected="selected"{{end}}>百度云短信</option>
<option value="rlydh" {{if eq .Template.Tpltype "rlydh"}}selected="selected"{{end}}>容联云电话</option>
<option value="rlydh" {{if eq .Template.Tpltype "7moordx"}}selected="selected"{{end}}>七陌短信</option>
<option value="rlydh" {{if eq .Template.Tpltype "7moordh"}}selected="selected"{{end}}>七陌语音电话</option>
<option value="email" {{if eq .Template.Tpltype "email"}}selected="selected"{{end}}>Email</option>
<option value="tg" {{if eq .Template.Tpltype "tg"}}selected="selected"{{end}}>Telegram</option>
<option value="rl" {{if eq .Template.Tpltype "rl"}}selected="selected"{{end}}>百度Hi(如流)</option>
Expand All @@ -56,7 +58,7 @@
<option value="Grafana" {{if eq .Template.Tpluse "Grafana"}}selected="selected"{{end}}>Grafana</option>
<option value="SonarQube" {{if eq .Template.Tpluse "SonarQube"}}selected="selected"{{end}}>SonarQube</option>
<option value="Jenkins" {{if eq .Template.Tpluse "Jenkins"}}selected="selected"{{end}}>Jenkins</option>
<option value="SonarQube" {{if eq .Template.Tpluse "Other"}}selected="selected"{{end}}>Other</option>
<option value="Other" {{if eq .Template.Tpluse "Other"}}selected="selected"{{end}}>Other</option>
</select>
</div>
<br />
Expand Down
2 changes: 1 addition & 1 deletion example/windows/views/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</tr>

<tr>
<th>15</th>
<th>16</th>
<th>百度Hi(如流)</th>
<th><button class="btn btn-primary" data-toggle='modal' id="bdrl">告警测试</button></th>
</tr>
Expand Down
2 changes: 2 additions & 0 deletions views/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
{{if eq .Tpltype "hwdx"}}华为云短信{{end}}
{{if eq .Tpltype "bddx"}}百度云短信{{end}}
{{if eq .Tpltype "rlydh"}}容联云电话{{end}}
{{if eq .Tpltype "7moordx"}}七陌短信{{end}}
{{if eq .Tpltype "7moordh"}}七陌语音电话{{end}}
{{if eq .Tpltype "email"}}Email{{end}}
{{if eq .Tpltype "tg"}}Telegram{{end}}
{{if eq .Tpltype "rl"}}百度Hi(如流){{end}}
Expand Down
2 changes: 2 additions & 0 deletions views/template_add.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
<option value="hwdx">华为云短信</option>
<option value="bddx">百度云短信</option>
<option value="rlydh">容联云电话</option>
<option value="7moordx">七陌短信</option>
<option value="7moordh">七陌语音电话</option>
<option value="email">Email</option>
<option value="tg">Telegram</option>
<option value="rl">百度Hi(如流)</option>
Expand Down
4 changes: 3 additions & 1 deletion views/template_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<option value="hwdx" {{if eq .Template.Tpltype "hwdx"}}selected="selected"{{end}}>华为云短信</option>
<option value="bddx" {{if eq .Template.Tpltype "bddx"}}selected="selected"{{end}}>百度云短信</option>
<option value="rlydh" {{if eq .Template.Tpltype "rlydh"}}selected="selected"{{end}}>容联云电话</option>
<option value="rlydh" {{if eq .Template.Tpltype "7moordx"}}selected="selected"{{end}}>七陌短信</option>
<option value="rlydh" {{if eq .Template.Tpltype "7moordh"}}selected="selected"{{end}}>七陌语音电话</option>
<option value="email" {{if eq .Template.Tpltype "email"}}selected="selected"{{end}}>Email</option>
<option value="tg" {{if eq .Template.Tpltype "tg"}}selected="selected"{{end}}>Telegram</option>
<option value="rl" {{if eq .Template.Tpltype "rl"}}selected="selected"{{end}}>百度Hi(如流)</option>
Expand All @@ -56,7 +58,7 @@
<option value="Grafana" {{if eq .Template.Tpluse "Grafana"}}selected="selected"{{end}}>Grafana</option>
<option value="SonarQube" {{if eq .Template.Tpluse "SonarQube"}}selected="selected"{{end}}>SonarQube</option>
<option value="Jenkins" {{if eq .Template.Tpluse "Jenkins"}}selected="selected"{{end}}>Jenkins</option>
<option value="SonarQube" {{if eq .Template.Tpluse "Other"}}selected="selected"{{end}}>Other</option>
<option value="Other" {{if eq .Template.Tpluse "Other"}}selected="selected"{{end}}>Other</option>
</select>
</div>
<br />
Expand Down
2 changes: 1 addition & 1 deletion views/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
</tr>

<tr>
<th>15</th>
<th>16</th>
<th>百度Hi(如流)</th>
<th><button class="btn btn-primary" data-toggle='modal' id="bdrl">告警测试</button></th>
</tr>
Expand Down

0 comments on commit 763cf8b

Please sign in to comment.