diff --git a/adaptors/安心云最新设备数据toES.go b/adaptors/安心云最新设备数据toES.go index 2ae9d3f..f2c9be1 100644 --- a/adaptors/安心云最新设备数据toES.go +++ b/adaptors/安心云最新设备数据toES.go @@ -133,7 +133,7 @@ func toEsRaw(deviceData *models.DeviceData) *models.EsRaw { StructId: deviceData.StructId, IotaDeviceName: deviceData.Name, Data: deviceData.Raw, - CollectTime: deviceData.AcqTime, + CollectTime: deviceData.AcqTime.Format("2006-01-02T15:04:05.000+0800"), Meta: dataOutMeta, IotaDevice: deviceData.DeviceId, CreateTime: time.Now(), diff --git a/dbHelper/elasticsearchHelper.go b/dbHelper/elasticsearchHelper.go index 1042bf8..1a64afc 100644 --- a/dbHelper/elasticsearchHelper.go +++ b/dbHelper/elasticsearchHelper.go @@ -191,7 +191,7 @@ func (the *ESHelper) BulkWrite(index, reqBody string) { if res.StatusCode != 200 && res.StatusCode != 201 { log.Panicf("es 写入失败,err=%s \n body=%s", string(respBody), reqBody) } - log.Printf("es 写入[%s],完成,res=%s ", index, reqBody) + log.Printf("es 写入[%s],完成,res=%s ", index, respBody) } diff --git a/models/esRaw.go b/models/esRaw.go index b893c24..a09dc67 100644 --- a/models/esRaw.go +++ b/models/esRaw.go @@ -6,7 +6,7 @@ type EsRaw struct { StructId int `json:"structId"` IotaDeviceName string `json:"iota_device_name"` Data map[string]any `json:"data"` - CollectTime time.Time `json:"collect_time"` + CollectTime string `json:"collect_time"` Meta map[string]string `json:"meta"` IotaDevice string `json:"iota_device"` CreateTime time.Time `json:"create_time"`