Commit aed6e256 authored by 李世星's avatar 李世星

fix(优化日志参数读取): 0

parent fb689e1a
Pipeline #16334 passed with stage
in 0 seconds
...@@ -88,7 +88,7 @@ func pluginNotice(msg interface{}) string { ...@@ -88,7 +88,7 @@ func pluginNotice(msg interface{}) string {
} }
if t == "float64" { if t == "float64" {
value = fmt.Sprintf("%.0f", value) value = fmt.Sprintf("%f", value)
} }
if t == "slice" { if t == "slice" {
value = fmt.Sprintf("%v", value) value = fmt.Sprintf("%v", value)
......
...@@ -2,7 +2,9 @@ package plugin ...@@ -2,7 +2,9 @@ package plugin
import ( import (
"context" "context"
"fmt"
"log" "log"
"reflect"
"strings" "strings"
"github.com/y7ut/logtransfer/ding" "github.com/y7ut/logtransfer/ding"
...@@ -24,6 +26,9 @@ func (d *Ding) HandleFunc(m *entity.Matedata) error { ...@@ -24,6 +26,9 @@ func (d *Ding) HandleFunc(m *entity.Matedata) error {
dingMobileData = strings.Split(dingMobiles, ",") dingMobileData = strings.Split(dingMobiles, ",")
} }
for k, v := range (*m).Data { for k, v := range (*m).Data {
if k == "level" && reflect.TypeOf(v).Kind().String() == "float64" {
v = fmt.Sprintf("%.0f", v)
}
if dingWebHook != "" && k == searchKey && (searchValue == "" || searchValue == v) { if dingWebHook != "" && k == searchKey && (searchValue == "" || searchValue == v) {
send = true send = true
break break
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment