|
|
@ -87,7 +87,7 @@ func (s *StationData) GetValidThemeData() (map[string]float64, bool) { |
|
|
|
} |
|
|
|
|
|
|
|
func (s *Station) LogMsg() string { |
|
|
|
logTagThing := fmt.Sprintf("[%s:%s][%s:%s]", logTag.Thing, s.Info.ThingId, logTag.Station, s.Info.Id) |
|
|
|
logTagThing := fmt.Sprintf("[%s:%s][%s:%d]", logTag.Thing, s.Info.ThingId, logTag.Station, s.Info.Id) |
|
|
|
|
|
|
|
var deviceLogs []string |
|
|
|
for _, device := range s.Info.Devices { |
|
|
@ -99,26 +99,26 @@ func (s *Station) LogMsg() string { |
|
|
|
} |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (m *Station) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(m) |
|
|
|
func (s *Station) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(s) |
|
|
|
} |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (m *Station) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, m) |
|
|
|
func (s *Station) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, s) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
type StationArrayObj []Station |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (m *StationArrayObj) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(m) |
|
|
|
func (s *StationArrayObj) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(s) |
|
|
|
} |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (m *StationArrayObj) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, m) |
|
|
|
func (s *StationArrayObj) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, s) |
|
|
|
} |
|
|
|
|
|
|
|
type DeviceProto struct { |
|
|
@ -150,18 +150,18 @@ type StationInfo struct { |
|
|
|
} |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (m *StationInfo) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(m) |
|
|
|
func (s *StationInfo) MarshalBinary() (data []byte, err error) { |
|
|
|
return json.Marshal(s) |
|
|
|
} |
|
|
|
|
|
|
|
// redis序列化
|
|
|
|
func (m *StationInfo) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, m) |
|
|
|
func (s *StationInfo) UnmarshalBinary(data []byte) error { |
|
|
|
return json.Unmarshal(data, s) |
|
|
|
} |
|
|
|
|
|
|
|
func (the *StationInfo) GetDeviceIdArray() []string { |
|
|
|
func (s *StationInfo) GetDeviceIdArray() []string { |
|
|
|
var deviceIdArray []string |
|
|
|
for _, device := range the.Devices { |
|
|
|
for _, device := range s.Devices { |
|
|
|
deviceIdArray = append(deviceIdArray, device.IotaDeviceId) |
|
|
|
} |
|
|
|
return deviceIdArray |
|
|
|