|
@@ -70,7 +70,7 @@ type TempAlarmNodeConfig struct {
|
|
|
ProductKey string `json:"product_key"` // 设备产品key
|
|
|
Duration int `json:"duration"` // 持续时间
|
|
|
Interval int `json:"interval"` // 告警间隔
|
|
|
- FillUserInfo bool `json:"fill_user_info"` // 是否需要匹配用户信息
|
|
|
+ FillUserInfo string `json:"fill_user_info"` // 是否需要匹配用户信息
|
|
|
Rules []*Rule `json:"rules"` // 报警规则
|
|
|
MessageTemplate string `json:"message_template"` // 报警内容模板
|
|
|
MessageFields []*MessageFields `json:"message_fields"` // 报警内容字段
|
|
@@ -107,7 +107,7 @@ type AlarmMessage struct {
|
|
|
func (t *TempAlarmNode) newAlarmMessage(message *protocol.Message) error {
|
|
|
dataMap := make(map[string]interface{})
|
|
|
var err error
|
|
|
- if t.config.FillUserInfo {
|
|
|
+ if t.config.FillUserInfo == "true" {
|
|
|
result, err := utils.NewRequest("GET", fmt.Sprintf("%s/%s", "http://127.0.0.1:8199/iot/v1/devices/", message.MetaData["device_id"].(string)), nil)
|
|
|
if err != nil {
|
|
|
return err
|
|
@@ -134,9 +134,12 @@ func (t *TempAlarmNode) newAlarmMessage(message *protocol.Message) error {
|
|
|
func (t *TempAlarmNode) evaluateConditions(message *protocol.Message) bool {
|
|
|
deviceId := message.MetaData["device_id"].(string)
|
|
|
fmt.Printf("message------------------:%s\r\n", gjson.New(message.MetaData).MustToJsonString())
|
|
|
+
|
|
|
+ fmt.Printf("productKey------------------:%s\r\n", message.MetaData["product_key"])
|
|
|
+ fmt.Printf("config:--------------------%s\r\n", gjson.New(t.config).MustToJsonString())
|
|
|
// 判断设备类型
|
|
|
- if message.MetaData["product_key"] != t.config.ProductKey {
|
|
|
- fmt.Printf("productKey------------------:%s\r\n", message.MetaData["product_key"])
|
|
|
+ if message.MetaData["product_key"].(string) != t.config.ProductKey {
|
|
|
+
|
|
|
return false
|
|
|
}
|
|
|
|