|
|
|
@ -6,6 +6,7 @@ using NPOI.XWPF.UserModel; |
|
|
|
using System.Net.Http.Json; |
|
|
|
using System.Net.Http.Json; |
|
|
|
using System.Text; |
|
|
|
using System.Text; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Text.Json; |
|
|
|
|
|
|
|
using Video.Application.ResponeDto; |
|
|
|
using Video.DomainService.Dahvision; |
|
|
|
using Video.DomainService.Dahvision; |
|
|
|
|
|
|
|
|
|
|
|
namespace Video.DomainService |
|
|
|
namespace Video.DomainService |
|
|
|
@ -339,6 +340,7 @@ namespace Video.DomainService |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// rtsp录像回放 |
|
|
|
/// rtsp录像回放 |
|
|
|
|
|
|
|
/// TODO:后续增加一个调用视频信息接口,去得到里面recordType=多少 |
|
|
|
/// (播放命令:ffplay -rtsp_transport tcp -i "rtsp://demo.weienergy.cn:15210/dss/monitor/param/cameraid=1000021%24104%26substream=1?token=430")强制走tcp |
|
|
|
/// (播放命令:ffplay -rtsp_transport tcp -i "rtsp://demo.weienergy.cn:15210/dss/monitor/param/cameraid=1000021%24104%26substream=1?token=430")强制走tcp |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
/// <param name="dto"></param> |
|
|
|
/// <param name="dto"></param> |
|
|
|
@ -362,12 +364,44 @@ namespace Video.DomainService |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1009", Msg = "token无效" }; |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1009", Msg = "token无效" }; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询普通录像信息,这块是为了知道recordType=多少 |
|
|
|
|
|
|
|
var urls = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/SS/Record/QueryRecords"; |
|
|
|
|
|
|
|
if (ipaddress != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
urls = $"https://{ipaddress}/evo-apigw/admin/API/SS/Record/QueryRecords"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
RtspPlayBackReqDto reqDto = new RtspPlayBackReqDto() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Data = new() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
ChannelId = dto.Data.ChannelId, |
|
|
|
|
|
|
|
RecordSource = dto.Data.RecordSource, |
|
|
|
|
|
|
|
startTime = dto.Data.startTime, |
|
|
|
|
|
|
|
EndTime = dto.Data.EndTime, |
|
|
|
|
|
|
|
StreamType = dto.Data.StreamType, |
|
|
|
|
|
|
|
RecordType = "0" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
using var reqs = new HttpRequestMessage(HttpMethod.Post, urls) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Content = JsonContent.Create(reqDto) // 关键:把 dto 放进请求体 |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
reqs.Headers.TryAddWithoutValidation("Authorization", token); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using var resp = await _http.SendAsync(reqs); |
|
|
|
|
|
|
|
var bodys = await resp.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
var resultRecord = JsonSerializer.Deserialize<DaHApiResult<RecordDataResDto>>(bodys); |
|
|
|
|
|
|
|
if (resultRecord == null || !resultRecord.Success) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_logger.LogWarning("查询普通录像信息: {Body}", bodys); |
|
|
|
|
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1008", Msg = "查询普通录像信息" }; |
|
|
|
|
|
|
|
} |
|
|
|
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime"; |
|
|
|
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime"; |
|
|
|
if (ipaddress != null) |
|
|
|
if (ipaddress != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
url = $"https://{ipaddress}/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime"; |
|
|
|
url = $"https://{ipaddress}/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
dto.Data.RecordType = resultRecord.Data!.Records[0].RecordType; |
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, url) |
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, url) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Content = JsonContent.Create(dto) // 关键:把 dto 放进请求体 |
|
|
|
Content = JsonContent.Create(dto) // 关键:把 dto 放进请求体 |
|
|
|
@ -376,8 +410,8 @@ namespace Video.DomainService |
|
|
|
|
|
|
|
|
|
|
|
try |
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
using var resp = await _http.SendAsync(req); // 关键:用 SendAsync 发送 req |
|
|
|
using var rep = await _http.SendAsync(req); |
|
|
|
var body = await resp.Content.ReadAsStringAsync(); |
|
|
|
var body = await rep.Content.ReadAsStringAsync(); |
|
|
|
|
|
|
|
|
|
|
|
if (!resp.IsSuccessStatusCode) |
|
|
|
if (!resp.IsSuccessStatusCode) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|