qixiaoning
23 小时以前 03880bf61cf059f063e252ef17dfea50c932c9dc
push-service/vo/eventPush.go
@@ -7,49 +7,52 @@
)
type EventPushVo struct {
   Id             string                `json:"id"`
   Name          string                `json:"name"`
   TimeStart       string                `json:"time_start"`
   TimeEnd       string                `json:"time_end"`
   IsSatisfyAll    bool                `json:"is_satisfy_all"`
   RuleText       string                `json:"rule_text"`
   Enable          bool                `json:"enable"`
   LinkType       string                `json:"link_type"`
   LinkDevice       string                `json:"link_device"`
   Id           string `json:"id"`
   Name         string `json:"name"`
   PushType     int    `json:"push_type"`
   TimeStart    string `json:"time_start"`
   TimeEnd      string `json:"time_end"`
   IsSatisfyAll bool   `json:"is_satisfy_all"`
   RuleText     string `json:"rule_text"`
   Enable       bool   `json:"enable"`
   LinkType     string `json:"link_type"`
   LinkDevice   string `json:"link_device"`
   IpPorts       []EventPushServerPortVo `json:"ip_ports"`
   Urls          []EventUrlVo          `json:"urls"`
   Rules          []models.EventPushRule    `json:"rules"`
   IpPorts []EventPushServerPortVo `json:"ip_ports"`
   Urls    []EventUrlVo            `json:"urls"`
   Rules   []models.EventPushRule  `json:"rules"`
   FiltRename         map[string]string        `json:"filtRename"`
   PushSet       []PushSetMenu          `json:"push_set"`
   FiltRename map[string]string `json:"filtRename"`
   PushSet    []PushSetMenu     `json:"push_set"`
}
type PushSetMenu struct {
   Id          string             `json:"id"`
   Name       string             `json:"name"`
   Checked    bool             `json:"checked"`
   Alias       string             `json:"alias"`
   Children    []PushSetMenu      `json:"children"`
   Id       string        `json:"id"`
   Name     string        `json:"name"`
   Checked  bool          `json:"checked"`
   Alias    string        `json:"alias"`
   Children []PushSetMenu `json:"children"`
}
type EventPushServerPortVo struct {
   ServerIp string `json:"server_ip"`
   Port int `json:"port"`
   Enable bool `json:"enable"`
   Port     int    `json:"port"`
   Enable   bool   `json:"enable"`
}
type EventUrlVo struct {
   Url string `json:"url"`
   Enable bool `json:"enable"`
   Url      string `json:"url"`
   ServerIp string `json:"server_ip"`
   Port     int    `json:"port"`
   Enable   bool   `json:"enable"`
}
func (epv *EventPushVo) SetFiltRename() {
   epv.FiltRename = make(map[string]string)
   if epv.PushSet != nil {
      for _,set := range epv.PushSet {
         if set.Children !=nil {
            for _,child := range set.Children {
      for _, set := range epv.PushSet {
         if set.Children != nil {
            for _, child := range set.Children {
               if child.Checked {
                  prefix := ""
                  idx := strings.LastIndex(child.Id, ".")
@@ -65,34 +68,36 @@
}
func (epv *EventPushVo) CopyToEventPush() models.EventPush {
   d,_ := json.Marshal(epv.PushSet)
   d, _ := json.Marshal(epv.PushSet)
   return models.EventPush{
      Id:epv.Id,
      Name:epv.Name,
      TimeStart:epv.TimeStart,
      TimeEnd:epv.TimeEnd,
      IsSatisfyAll:epv.IsSatisfyAll,
      RuleText:epv.RuleText,
      Enable:epv.Enable,
      LinkType:epv.LinkType,
      LinkDevice:epv.LinkDevice,
      PushSet: string(d),
      Id:           epv.Id,
      Name:         epv.Name,
      TimeStart:    epv.TimeStart,
      TimeEnd:      epv.TimeEnd,
      IsSatisfyAll: epv.IsSatisfyAll,
      RuleText:     epv.RuleText,
      Enable:       epv.Enable,
      PushType:     epv.PushType,
      LinkType:     epv.LinkType,
      LinkDevice:   epv.LinkDevice,
      PushSet:      string(d),
   }
}
func (epv *EventPushVo) CopyFromEventPush(epE *models.EventPush){
func (epv *EventPushVo) CopyFromEventPush(epE *models.EventPush) {
   epv.Id = epE.Id
   epv.Name = epE.Name
   epv.TimeStart = epE.TimeStart
   epv.TimeEnd = epE.TimeEnd
   epv.IsSatisfyAll = epE.IsSatisfyAll
   epv.PushType = epE.PushType
   epv.RuleText = epE.RuleText
   epv.Enable = epE.Enable
   epv.LinkType = epE.LinkType
   epv.LinkDevice = epE.LinkDevice
   if epE.PushSet != "" {
      var set []PushSetMenu
      if err := json.Unmarshal([]byte(epE.PushSet), &set);err == nil {
      if err := json.Unmarshal([]byte(epE.PushSet), &set); err == nil {
         epv.PushSet = set
      } else {
         epv.PushSet = make([]PushSetMenu, 0)
@@ -102,8 +107,7 @@
   }
}
type KeyValueVo struct {
   Value string `json:"value"`
   Name string `json:"name"`
}
   Name  string `json:"name"`
}