实现基本的监控终端管理

This commit is contained in:
刘祥超
2021-09-08 19:34:31 +08:00
parent 838d33648f
commit 1ea7fe0213
13 changed files with 402 additions and 36 deletions

View File

@@ -1,12 +1,28 @@
package models
import "encoding/json"
import (
"encoding/json"
"github.com/TeaOSLab/EdgeAPI/internal/remotelogs"
)
func (this *ReportNode) DecodeAllowIPs() []string {
var result = []string{}
if len(this.AllowIPs) > 0 {
// 忽略错误
_ = json.Unmarshal([]byte(this.AllowIPs), &result)
err := json.Unmarshal([]byte(this.AllowIPs), &result)
if err != nil {
remotelogs.Error("ReportNode.DecodeGroupIds", err.Error())
}
}
return result
}
func (this *ReportNode) DecodeGroupIds() []int64 {
var result = []int64{}
if len(this.GroupIds) > 0 {
err := json.Unmarshal([]byte(this.GroupIds), &result)
if err != nil {
remotelogs.Error("ReportNode.DecodeGroupIds", err.Error())
}
}
return result
}