From 7799d5acb4a25526625b3e99c2f7fd71d1be39ff Mon Sep 17 00:00:00 2001
From: qixiaoning <jony.kee@outlook.com>
Date: 星期二, 26 八月 2025 08:47:58 +0800
Subject: [PATCH] mqtt引入
---
push-service/vo/eventPush.go | 88 +++++++++++++++++++++++---------------------
1 files changed, 46 insertions(+), 42 deletions(-)
diff --git a/push-service/vo/eventPush.go b/push-service/vo/eventPush.go
index 9e14072..28a4414 100644
--- a/push-service/vo/eventPush.go
+++ b/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"`
-}
\ No newline at end of file
+ Name string `json:"name"`
+}
--
Gitblit v1.8.0