WebAPI 支持摄像头启停控制、码流切换、审计日志的提供
This commit is contained in:
@@ -96,5 +96,28 @@ public class MonitorController : ControllerBase
|
||||
return File(imageBytes, "image/jpeg");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定相机的诊断信息(含审计日志)
|
||||
/// </summary>
|
||||
/// <param name="id">相机设备唯一标识</param>
|
||||
/// <returns>200 OK + 诊断信息 | 404 Not Found</returns>
|
||||
[HttpGet("diagnose/{id}")]
|
||||
public IActionResult GetDeviceDiagnostic(long id)
|
||||
{
|
||||
var device = _cameraManager.GetDevice(id);
|
||||
if (device == null) return NotFound();
|
||||
|
||||
return Ok(new
|
||||
{
|
||||
Id = device.Id,
|
||||
Status = device.Status.ToString(),
|
||||
RealFps = device.RealFps,
|
||||
TotalFrames = device.TotalFrames,
|
||||
// 关键:将 BaseVideoSource 中的日志列表返回给前端
|
||||
// 注意:属性名 AuditLogs 会被序列化为 auditLogs (首字母小写),符合前端预期
|
||||
AuditLogs = device.GetAuditLogs()
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user