diff --git a/adaptors/安心云最新设备数据toES.go b/adaptors/安心云最新设备数据toES.go index 0a26405..ad2d9e2 100644 --- a/adaptors/安心云最新设备数据toES.go +++ b/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 } diff --git a/consumers/consumerAXYraw.go b/consumers/consumerAXYraw.go index a0c61dd..25a755c 100644 --- a/consumers/consumerAXYraw.go +++ b/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