节点IP地址可以设置阈值

This commit is contained in:
GoEdgeLab
2021-08-18 16:19:16 +08:00
parent 9a57030ff1
commit ec1c59f33a
6 changed files with 159 additions and 6 deletions

View File

@@ -1 +1,20 @@
package models
import (
"encoding/json"
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
"github.com/iwind/TeaGo/logs"
)
func (this *NodeIPAddress) DecodeThresholds() []*nodeconfigs.NodeValueThresholdConfig {
var result = []*nodeconfigs.NodeValueThresholdConfig{}
if len(this.Thresholds) == 0 {
return result
}
err := json.Unmarshal([]byte(this.Thresholds), &result)
if err != nil {
// 不处理错误
logs.Error(err)
}
return result
}