package iotDownService import ( iotLog "IotAdmin/iot/log" iotProtocolHandler "IotAdmin/iot/protocol/handler" iotStruct "IotAdmin/iot/struct" ) func reportData(dataArray *[]*iotStruct.CollectData) { if dataArray == nil || len(*dataArray) == 0 { return } for _, data := range *dataArray { cfg := data.SlaveConfig if cfg == nil { continue } for _, rc := range *cfg.ReportConfig { reportHandler, err := iotProtocolHandler.GetReportHandler(rc.Protocol) if err != nil { data.Logger.Errorf("GetReportHandler error:%s", err) continue } go func(d *iotStruct.CollectData, cfg *iotStruct.ReportConfig) { reportHandler.Adapter(d) str := reportHandler.Report(d, cfg) go iotLog.LogData(d, cfg, str) }(data, &rc) } } }