Browse Source

Merge branch 'dev' of https://gitea.anxinyun.cn/lucas2/goUpload into dev

pull/2/head
lucas 2 months ago
parent
commit
f3f164a36a
  1. 2
      adaptors/安心云最新设备数据toES.go
  2. 2
      dbHelper/elasticsearchHelper.go
  3. 2
      models/esRaw.go

2
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(),

2
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)
}

2
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"`

Loading…
Cancel
Save