|
|
|
@ -4,6 +4,7 @@ using Microsoft.Extensions.Configuration; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using Microsoft.Extensions.Logging; |
|
|
|
using NPOI.XWPF.UserModel; |
|
|
|
using NPOI.XWPF.UserModel; |
|
|
|
using System.Net.Http.Json; |
|
|
|
using System.Net.Http.Json; |
|
|
|
|
|
|
|
using System.Text; |
|
|
|
using System.Text.Json; |
|
|
|
using System.Text.Json; |
|
|
|
using Video.DomainService.Dahvision; |
|
|
|
using Video.DomainService.Dahvision; |
|
|
|
|
|
|
|
|
|
|
|
@ -106,7 +107,7 @@ namespace Video.DomainService |
|
|
|
/// <param name="dto"></param> |
|
|
|
/// <param name="dto"></param> |
|
|
|
/// <returns></returns> |
|
|
|
/// <returns></returns> |
|
|
|
/// <exception cref="NotImplementedException"></exception> |
|
|
|
/// <exception cref="NotImplementedException"></exception> |
|
|
|
public async Task<DaHApiResult<RecordsResDto>> QueryRecords(PlaybackReqDto dto) |
|
|
|
public async Task<DaHApiResult<RecordsResDto>> QueryRecords(RtspPlayBackReqDto dto) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// 0) 参数校验 + 早退(按需增加更多必填校验) |
|
|
|
// 0) 参数校验 + 早退(按需增加更多必填校验) |
|
|
|
if (dto == null) |
|
|
|
if (dto == null) |
|
|
|
@ -126,7 +127,7 @@ namespace Video.DomainService |
|
|
|
|
|
|
|
|
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, url) |
|
|
|
using var req = new HttpRequestMessage(HttpMethod.Post, url) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Content = JsonContent.Create(dto.Data) // 关键:把 dto 放进请求体 |
|
|
|
Content = JsonContent.Create(dto) // 关键:把 dto 放进请求体 |
|
|
|
}; |
|
|
|
}; |
|
|
|
req.Headers.TryAddWithoutValidation("Authorization", token); |
|
|
|
req.Headers.TryAddWithoutValidation("Authorization", token); |
|
|
|
|
|
|
|
|
|
|
|
@ -352,7 +353,7 @@ namespace Video.DomainService |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1007", Msg = "通道ID不能为空" }; |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1007", Msg = "通道ID不能为空" }; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 先用缓存里的 token,不足5分钟过期再刷新(按你之前的口径来) |
|
|
|
// 先用缓存里的 token,不足5分钟过期再刷新 |
|
|
|
var clientId = _configuration["DahuaAuth:ClientId"]; |
|
|
|
var clientId = _configuration["DahuaAuth:ClientId"]; |
|
|
|
var token = await _tokenProviderService.GetTokenAsync(clientId!); |
|
|
|
var token = await _tokenProviderService.GetTokenAsync(clientId!); |
|
|
|
if (!_tokenProviderService.IsTokenValid(token)) |
|
|
|
if (!_tokenProviderService.IsTokenValid(token)) |
|
|
|
@ -360,7 +361,7 @@ namespace Video.DomainService |
|
|
|
_logger.LogWarning("rtsp录像回放:token无效"); |
|
|
|
_logger.LogWarning("rtsp录像回放:token无效"); |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1009", Msg = "token无效" }; |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1009", Msg = "token无效" }; |
|
|
|
} |
|
|
|
} |
|
|
|
dto.Data.StreamType = "2"; |
|
|
|
|
|
|
|
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) |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -396,6 +397,7 @@ namespace Video.DomainService |
|
|
|
_configuration, |
|
|
|
_configuration, |
|
|
|
"Time" |
|
|
|
"Time" |
|
|
|
) + "?token=" + result.Data.Token; |
|
|
|
) + "?token=" + result.Data.Token; |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
catch (Exception ex) |
|
|
|
@ -428,7 +430,7 @@ namespace Video.DomainService |
|
|
|
_logger.LogWarning("rtsp实时预览接口方式:token无效"); |
|
|
|
_logger.LogWarning("rtsp实时预览接口方式:token无效"); |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1009", Msg = "token无效" }; |
|
|
|
return new DaHApiResult<UrlDataDto> { Success = false, Code = "1009", Msg = "token无效" }; |
|
|
|
} |
|
|
|
} |
|
|
|
dto.Data.StreamType = "2"; |
|
|
|
|
|
|
|
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/MTS/Video/StartVideo"; |
|
|
|
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/MTS/Video/StartVideo"; |
|
|
|
if (ipaddress != null) |
|
|
|
if (ipaddress != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|