Browse Source

update 调整不统一的指针接收器命名

go sdk 统一到1.23.1
dev
lucas 4 months ago
parent
commit
fcfda29281
  1. 2
      go.mod
  2. 30
      station.go

2
go.mod

@ -1,6 +1,6 @@
module gitea.anxinyun.cn/container/common_models module gitea.anxinyun.cn/container/common_models
go 1.22.0 go 1.23.1
require github.com/stretchr/testify v1.9.0 require github.com/stretchr/testify v1.9.0

30
station.go

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

Loading…
Cancel
Save