diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/DaHua/RequestDto/DahuaVideoQueryDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/DaHua/RequestDto/DahuaVideoQueryDto.cs
index cbf4a22..482d466 100644
--- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/DaHua/RequestDto/DahuaVideoQueryDto.cs
+++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/DaHua/RequestDto/DahuaVideoQueryDto.cs
@@ -59,11 +59,6 @@ namespace Common.Shared.Application.DaHua
public class PlaybackReqDto
{
public PlaybackItem Data { get; set; }
-
- ///
- /// 如果多个icc平台的话,决定是哪个平台的回放
- ///
- public string? IpAddress { get; set; }
}
///
@@ -114,11 +109,6 @@ namespace Common.Shared.Application.DaHua
public class RtspPlayBackReqDto
{
public RtspPlaybackItem Data { get; set; }
-
- ///
- /// 如果多个icc平台的话,决定是哪个平台的回放
- ///
- public string? IpAddress { get; set; }
}
///
@@ -268,11 +258,6 @@ namespace Common.Shared.Application.DaHua
///
[JsonPropertyName("data")]
public StreamRequestData Data { get; set; }
-
- ///
- /// 如果多个icc平台的话,决定是哪个平台的回放
- ///
- public string? IpAddress { get; set; }
}
///
@@ -286,10 +271,10 @@ namespace Common.Shared.Application.DaHua
[JsonPropertyName("data")]
public StreamRtspRequestData Data { get; set; }
- ///
- /// 如果多个icc平台的话,决定是哪个平台的回放
- ///
- public string? IpAddress { get; set; }
+ /////
+ ///// 如果多个icc平台的话,决定是哪个平台的回放
+ /////
+ //public string? IpAddress { get; set; }
}
///
diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.DomainService/DaHTokenService/TokenProviderService.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.DomainService/DaHTokenService/TokenProviderService.cs
index f2ee72a..602ce25 100644
--- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.DomainService/DaHTokenService/TokenProviderService.cs
+++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.DomainService/DaHTokenService/TokenProviderService.cs
@@ -309,11 +309,11 @@ namespace Common.Shared.DomainService
public bool IsTokenValid(string token)
{
// 避免 NullReferenceException
- if (string.IsNullOrWhiteSpace(token))
- return true;
+ if (string.IsNullOrWhiteSpace(token) && token.Length < 10)
+ return false;
// 统一写法,后续改条件只改这里
- return token.Length < 10;
+ return true;
}
#region RES加密
diff --git a/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs b/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs
index 9d3d55a..e1f0add 100644
--- a/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs
+++ b/WeiCloud.Fusion/VideoService/Video.API/Controllers/DaHua/VideoManageController.cs
@@ -37,9 +37,9 @@ namespace Video.API.Controllers.DaHua
///
///
[HttpPost("playback/dh")]
- public async Task> StartAndPlaybackDH(PlaybackReqDto dto)
+ public async Task> StartAndPlaybackDH([FromBody] PlaybackReqDto dto, [FromQuery] string? ipaddress)
{
- return await _rootVideoPlaybackService.GetDaHRecordVideoUrl(dto);
+ return await _rootVideoPlaybackService.GetDaHRecordVideoUrl(dto, ipaddress);
}
///
@@ -48,9 +48,9 @@ namespace Video.API.Controllers.DaHua
///
///
[HttpPost("rtspplayback/dh")]
- public async Task> RtspPlaybackByTime(RtspPlayBackReqDto dto)
+ public async Task> RtspPlaybackByTime([FromBody] RtspPlayBackReqDto dto, [FromQuery] string? ipaddress)
{
- return await _rootVideoPlaybackService.RtspPlaybackByTime(dto);
+ return await _rootVideoPlaybackService.RtspPlaybackByTime(dto, ipaddress);
}
///
@@ -59,9 +59,9 @@ namespace Video.API.Controllers.DaHua
///
///
[HttpPost("realtime/dh")]
- public async Task> GetRealtimeUrl(StreamReqDto dto)
+ public async Task> GetRealtimeUrl([FromBody] StreamReqDto dto, [FromQuery] string? ipaddress)
{
- return await _rootVideoPlaybackService.GetRealtimeUrl(dto);
+ return await _rootVideoPlaybackService.GetRealtimeUrl(dto, ipaddress);
}
///
@@ -70,9 +70,9 @@ namespace Video.API.Controllers.DaHua
///
///
[HttpPost("rtspstart/dh")]
- public async Task> RtspStartVideoUrl(StreamRtspReqDto dto)
+ public async Task> RtspStartVideoUrl([FromBody] StreamRtspReqDto dto, [FromQuery] string? ipaddress)
{
- return await _rootVideoPlaybackService.RtspStartVideoUrl(dto);
+ return await _rootVideoPlaybackService.RtspStartVideoUrl(dto, ipaddress);
}
///
diff --git a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/DahuaGeneralCtlService.cs b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/DahuaGeneralCtlService.cs
index e234798..07aa32e 100644
--- a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/DahuaGeneralCtlService.cs
+++ b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/DahuaGeneralCtlService.cs
@@ -38,7 +38,7 @@ namespace Video.DomainService
///
///
///
- public async Task> RecordVideoUrl(PlaybackReqDto dto)
+ public async Task> RecordVideoUrl(PlaybackReqDto dto, string? ipaddress)
{
// 1) 参数校验 + 早退
if (dto == null || string.IsNullOrWhiteSpace(dto.Data.ChannelId))
@@ -57,15 +57,15 @@ namespace Video.DomainService
return new DaHApiResult { Success = false, Code = "1009", Msg = "token无效" };
}
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/video/stream/record";
- if (dto.IpAddress != null)
+ if (ipaddress != null)
{
- url = $"https://{dto.IpAddress}/evo-apigw/admin/API/video/stream/record";
+ url = $"https://{ipaddress}/evo-apigw/admin/API/video/stream/record";
}
// 3) 构造请求(把 dto 放进 Body),并用 SendAsync 发送,才能带上头
using var req = new HttpRequestMessage(HttpMethod.Post, url)
{
- Content = JsonContent.Create(dto) // 关键:别再丢 body 了
+ Content = JsonContent.Create(dto.Data) // 关键:别再丢 body 了
};
req.Headers.TryAddWithoutValidation("Authorization", token);
@@ -86,7 +86,7 @@ namespace Video.DomainService
}
result.Data!.Url = UrlHostReplacer.ReplaceHost(
result.Data.Url,
- dto.IpAddress,
+ ipaddress,
_configuration,
"Time"
) + "?token=" + result.Data.Token;
@@ -122,13 +122,10 @@ namespace Video.DomainService
return new DaHApiResult { Success = false, Code = "1009", Msg = "token无效" };
}
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/SS/Record/QueryRecords";
- if (dto.IpAddress != null)
- {
- url = $"https://{dto.IpAddress}/evo-apigw/admin/API/SS/Record/QueryRecords";
- }
+
using var req = new HttpRequestMessage(HttpMethod.Post, url)
{
- Content = JsonContent.Create(dto) // 关键:把 dto 放进请求体
+ Content = JsonContent.Create(dto.Data) // 关键:把 dto 放进请求体
};
req.Headers.TryAddWithoutValidation("Authorization", token);
@@ -223,7 +220,7 @@ namespace Video.DomainService
///
///
///
- public async Task> RealtimeStreamUrl(StreamReqDto dto)
+ public async Task> RealtimeStreamUrl(StreamReqDto dto, string? ipaddress)
{
// 1) 参数校验 + 早退
if (dto == null || dto.Data == null)
@@ -245,15 +242,15 @@ namespace Video.DomainService
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/video/stream/realtime";
- if (dto.IpAddress != null)
+ if (ipaddress != null)
{
- url = $"https://{dto.IpAddress}/evo-apigw/admin/API/video/stream/realtime";
+ url = $"https://{ipaddress}/evo-apigw/admin/API/video/stream/realtime";
}
// 3) 用 HttpRequestMessage 发送,才能带上自定义头
using var req = new HttpRequestMessage(HttpMethod.Post, url)
{
- Content = JsonContent.Create(dto) // 等价 PostAsJsonAsync,但不会丢头
+ Content = JsonContent.Create(dto.Data) // 等价 PostAsJsonAsync,但不会丢头
};
req.Headers.TryAddWithoutValidation("Authorization", token);
@@ -274,7 +271,7 @@ namespace Video.DomainService
}
result.Data!.Url = UrlHostReplacer.ReplaceHost(
result.Data.Url,
- dto.IpAddress,
+ ipaddress,
_configuration,
"Real"
) + "?token=" + result.Data.Token;
@@ -345,7 +342,7 @@ namespace Video.DomainService
///
///
///
- public async Task> RtspPlaybackByTime(RtspPlayBackReqDto dto)
+ public async Task> RtspPlaybackByTime(RtspPlayBackReqDto dto, string? ipaddress)
{
// 参数校验 + 早退
if (dto == null || string.IsNullOrWhiteSpace(dto.Data.ChannelId))
@@ -364,14 +361,14 @@ namespace Video.DomainService
}
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime";
- if (dto.IpAddress != null)
+ if (ipaddress != null)
{
- url = $"https://{dto.IpAddress}/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime";
+ url = $"https://{ipaddress}/evo-apigw/admin/API/SS/Playback/StartPlaybackByTime";
}
using var req = new HttpRequestMessage(HttpMethod.Post, url)
{
- Content = JsonContent.Create(dto) // 关键:把 dto 放进请求体
+ Content = JsonContent.Create(dto.Data) // 关键:把 dto 放进请求体
};
req.Headers.TryAddWithoutValidation("Authorization", token);
@@ -394,7 +391,7 @@ namespace Video.DomainService
}
result.Data!.Url = UrlHostReplacer.ReplaceHost(
result.Data.Url,
- dto.IpAddress,
+ ipaddress,
_configuration,
"Time"
) + "?token=" + result.Data.Token;
@@ -414,7 +411,7 @@ namespace Video.DomainService
///
///
///
- public async Task> RtspStartVideoUrl(StreamRtspReqDto dto)
+ public async Task> RtspStartVideoUrl(StreamRtspReqDto dto, string? ipaddress)
{
if (dto == null || dto.Data == null)
{
@@ -431,9 +428,9 @@ namespace Video.DomainService
}
var url = $"https://{_configuration["DahuaAuth:Host"]}/evo-apigw/admin/API/MTS/Video/StartVideo";
- if (dto.IpAddress != null)
+ if (ipaddress != null)
{
- url = $"https://{dto.IpAddress}/evo-apigw/admin/API/MTS/Video/StartVideo";
+ url = $"https://{ipaddress}/evo-apigw/admin/API/MTS/Video/StartVideo";
}
using var req = new HttpRequestMessage(HttpMethod.Post, url)
@@ -461,7 +458,7 @@ namespace Video.DomainService
}
result.Data!.Url = UrlHostReplacer.ReplaceHost(
result.Data.Url,
- dto.IpAddress,
+ ipaddress,
_configuration,
"Real"
) + "?token=" + result.Data.Token;
diff --git a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IDahuaGeneralCtlService.cs b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IDahuaGeneralCtlService.cs
index 1a7f02e..215e0b3 100644
--- a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IDahuaGeneralCtlService.cs
+++ b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IDahuaGeneralCtlService.cs
@@ -19,14 +19,14 @@ namespace Video.DomainService
///
///
///
- Task> RecordVideoUrl(PlaybackReqDto dto);
+ Task> RecordVideoUrl(PlaybackReqDto dto, string? ipaddress);
///
/// Rtsp录像回放
///
///
///
- Task> RtspPlaybackByTime(RtspPlayBackReqDto dto);
+ Task> RtspPlaybackByTime(RtspPlayBackReqDto dto, string? ipaddress);
///
/// 设备通道分页查询,需要用于HlsRecordVideo
@@ -41,14 +41,14 @@ namespace Video.DomainService
///
///
///
- Task> RealtimeStreamUrl(StreamReqDto dto);
+ Task> RealtimeStreamUrl(StreamReqDto dto, string? ipaddress);
///
/// rtsp实时预览接口方式
///
///
///
- Task> RtspStartVideoUrl(StreamRtspReqDto dto);
+ Task> RtspStartVideoUrl(StreamRtspReqDto dto, string? ipaddress);
///
/// 注销认证信息
diff --git a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IRootVideoPlaybackService.cs b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IRootVideoPlaybackService.cs
index 6c6948a..a4b55f8 100644
--- a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IRootVideoPlaybackService.cs
+++ b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/IRootVideoPlaybackService.cs
@@ -10,28 +10,28 @@ namespace Video.DomainService
///
///
///
- Task> GetDaHRecordVideoUrl(PlaybackReqDto dto);
+ Task> GetDaHRecordVideoUrl(PlaybackReqDto dto, string? ipaddress);
///
/// 大华的实时视频
///
///
///
- Task> GetRealtimeUrl(StreamReqDto dto);
+ Task> GetRealtimeUrl(StreamReqDto dto, string? ipaddress);
///
/// rtsp实时预览接口方式
///
///
///
- Task> RtspStartVideoUrl(StreamRtspReqDto dto);
+ Task> RtspStartVideoUrl(StreamRtspReqDto dto, string? ipaddress);
///
/// rtsp录像回放
///
///
///
- Task> RtspPlaybackByTime(RtspPlayBackReqDto dto);
+ Task> RtspPlaybackByTime(RtspPlayBackReqDto dto, string? ipaddress);
///
/// 大华设备通道分页查询
diff --git a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/RootVideoPlaybackService.cs b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/RootVideoPlaybackService.cs
index b9fd7a8..b48d433 100644
--- a/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/RootVideoPlaybackService.cs
+++ b/WeiCloud.Fusion/VideoService/Video.DomainService/Dahvision/RootVideoPlaybackService.cs
@@ -35,11 +35,11 @@ namespace Video.DomainService
///
///
///
- public async Task> GetDaHRecordVideoUrl(PlaybackReqDto dto)
+ public async Task> GetDaHRecordVideoUrl(PlaybackReqDto dto, string? ipaddress)
{
ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功" };
- var urlReult = await _dahuaGeneralCtlService.RecordVideoUrl(dto);
+ var urlReult = await _dahuaGeneralCtlService.RecordVideoUrl(dto, ipaddress);
if (!urlReult.Success)
{
result.Code = 500;
@@ -58,10 +58,10 @@ namespace Video.DomainService
///
///
///
- public async Task> GetRealtimeUrl(StreamReqDto dto)
+ public async Task> GetRealtimeUrl(StreamReqDto dto, string? ipaddress)
{
ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功" };
- var urlReult = await _dahuaGeneralCtlService.RealtimeStreamUrl(dto);
+ var urlReult = await _dahuaGeneralCtlService.RealtimeStreamUrl(dto, ipaddress);
if (!urlReult.Success)
{
result.Code = 500;
@@ -123,10 +123,10 @@ namespace Video.DomainService
///
///
///
- public async Task> RtspStartVideoUrl(StreamRtspReqDto dto)
+ public async Task> RtspStartVideoUrl(StreamRtspReqDto dto, string? ipaddress)
{
ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功" };
- var urlReult = await _dahuaGeneralCtlService.RtspStartVideoUrl(dto);
+ var urlReult = await _dahuaGeneralCtlService.RtspStartVideoUrl(dto, ipaddress);
if (!urlReult.Success)
{
result.Code = 500;
@@ -142,11 +142,11 @@ namespace Video.DomainService
///
///
///
- public async Task> RtspPlaybackByTime(RtspPlayBackReqDto dto)
+ public async Task> RtspPlaybackByTime(RtspPlayBackReqDto dto, string? ipaddress)
{
ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功" };
- var urlReult = await _dahuaGeneralCtlService.RtspPlaybackByTime(dto);
+ var urlReult = await _dahuaGeneralCtlService.RtspPlaybackByTime(dto, ipaddress);
if (!urlReult.Success)
{
result.Code = 500;