fix: 告警CSV视频源用摄像头名称而非通道名
This commit is contained in:
parent
d166214659
commit
ca7be71f90
@ -2726,12 +2726,26 @@ func (u *UI) apiAlarmExport(w http.ResponseWriter, r *http.Request) {
|
||||
for _, a := range records {
|
||||
devName := a.DeviceID
|
||||
devIP := ""
|
||||
sourceName := a.Channel
|
||||
if dev, ok := deviceMap[a.DeviceID]; ok {
|
||||
devName = dev.DisplayName()
|
||||
devIP = dev.IP
|
||||
}
|
||||
// Resolve channel to video source name
|
||||
if u.preview != nil {
|
||||
if assignment, err := u.preview.GetDeviceAssignment(a.DeviceID); err == nil && assignment != nil {
|
||||
for _, ref := range assignment.RecognitionUnits {
|
||||
if unit, err := u.preview.GetRecognitionUnit(ref); err == nil && unit != nil {
|
||||
if unit.Name == a.Channel && unit.VideoSourceRef != "" {
|
||||
sourceName = unit.VideoSourceRef
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(w, "%s,%s,%s,%s,%s,%s,%s\n",
|
||||
escapeCSV(devName), escapeCSV(devIP), escapeCSV(a.Channel),
|
||||
escapeCSV(devName), escapeCSV(devIP), escapeCSV(sourceName),
|
||||
escapeCSV(alarmRuleLabel(a.RuleName)), escapeCSV(a.ObjectLabel),
|
||||
escapeCSV(alarmStatusLabel(a.Status)), escapeCSV(a.Timestamp))
|
||||
}
|
||||
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user