You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.2 KiB

package common_models
import (
"encoding/json"
"time"
)
type AlarmMsg struct {
MessageMode string `json:"messageMode"`
StructureId int `json:"structureId"`
StructureName string `json:"structureName"`
SourceId string `json:"sourceId"`
SourceName string `json:"sourceName"`
AlarmTypeCode string `json:"alarmTypeCode"`
AlarmCode string `json:"alarmCode"`
Content string `json:"content"`
AcqTime time.Time `json:"time"`
SourceTypeId int `json:"sourceTypeId"` // 0:DTU, 1:传感器, 2:测点
Sponsor string `json:"sponsor"` // 消息的发起者 "et.recv"
Extras map[string]any `json:"extras"`
SubDevices []string `json:"subDevices"`
}
type AlarmCode struct {
Id int `json:"id"`
Code string `json:"code"`
Name string `json:"name"`
TypeCode string `json:"typeCode"`
Level int `json:"level"`
}
// redis序列化
func (m *AlarmCode) MarshalBinary() (data []byte, err error) {
return json.Marshal(m)
}
// redis序列化
func (m *AlarmCode) UnmarshalBinary(data []byte) error {
return json.Unmarshal(data, m)
}