Browse Source

add raw last 日志

dev
lucas 1 month ago
parent
commit
fb18e49ef7
  1. 9
      adaptors/安心云最新设备数据toES.go
  2. 5
      consumers/consumerAXYraw.go

9
adaptors/安心云最新设备数据toES.go

@ -71,7 +71,7 @@ func (the Adaptor_AXY_LastRAW) raw2es(iotaData models.IotaData) *models.EsRaw {
if iotaData.DeviceId == the.TagDeviceId {
log.Printf("--> raw2es 标记设备[%s]数据 %v ", iotaData.DeviceId, iotaData.Data.Data)
}
EsRaws := toEsRaw(devdata)
EsRaws := the.toEsRaw(devdata)
return EsRaws
}
@ -138,7 +138,7 @@ func (the Adaptor_AXY_LastRAW) GetDeviceInfoFromRedis(deviceId string) (models.D
}, nil
}
func toEsRaw(deviceData *models.DeviceData) *models.EsRaw {
func (the Adaptor_AXY_LastRAW) toEsRaw(deviceData *models.DeviceData) *models.EsRaw {
if deviceData == nil {
return nil
@ -154,6 +154,9 @@ func toEsRaw(deviceData *models.DeviceData) *models.EsRaw {
IotaDevice: deviceData.DeviceId,
CreateTime: time.Now(),
}
if createNativeRaw.IotaDevice == the.TagDeviceId {
str, _ := json.Marshal(createNativeRaw)
log.Printf("--> toEsRaw 标记设备[%s]数据 %s ", the.TagDeviceId, str)
}
return &createNativeRaw
}

5
consumers/consumerAXYraw.go

@ -160,6 +160,11 @@ func (the *consumerAXYraw) onData(topic string, msg string) bool {
log.Printf("onData -> needPush 标记设备数据 [%s] %s ", logTagDeviceId, string(bs))
}
the.dataCache <- needPush
} else {
s, _ := json.Marshal(needPush)
if needPush != nil {
log.Printf("onData 设备[%s] 异常needPush= %s", needPush.IotaDevice, s)
}
}
return true

Loading…
Cancel
Save