Browse Source

update 强制使用 8 时区 转换

pull/2/head
lucas 1 month ago
parent
commit
4f452dbfcd
  1. 4
      adaptors/安心云最新设备数据toES.go

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

@ -127,13 +127,13 @@ func toEsRaw(deviceData *models.DeviceData) *models.EsRaw {
if deviceData == nil { if deviceData == nil {
return nil return nil
} }
var cstZone = time.FixedZone("CST", 8*3600) // 东八区 用以解决
dataOutMeta := deviceData.DeviceInfo.DeviceMeta.GetOutputProps() dataOutMeta := deviceData.DeviceInfo.DeviceMeta.GetOutputProps()
createNativeRaw := models.EsRaw{ createNativeRaw := models.EsRaw{
StructId: deviceData.StructId, StructId: deviceData.StructId,
IotaDeviceName: deviceData.Name, IotaDeviceName: deviceData.Name,
Data: deviceData.Raw, Data: deviceData.Raw,
CollectTime: deviceData.AcqTime.Format("2006-01-02T15:04:05.000+0800"), CollectTime: deviceData.AcqTime.In(cstZone).Format("2006-01-02T15:04:05.000+0800"),
Meta: dataOutMeta, Meta: dataOutMeta,
IotaDevice: deviceData.DeviceId, IotaDevice: deviceData.DeviceId,
CreateTime: time.Now(), CreateTime: time.Now(),

Loading…
Cancel
Save