From f996d26928e149e269c7389f5fb0e347ef1303a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=81=20=E4=BB=BB?= Date: Mon, 5 Jan 2026 11:16:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=B7=E5=BA=B7=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OpenAuth.App/Common/KikvisionConfig.cs | 17 +++++++++ .../FireManagement/FireManagementApp.cs | 36 ++++++++++++++++++- .../FireManagementController.cs | 20 +++++++++++ OpenAuth.WebApi/Startup.cs | 1 + OpenAuth.WebApi/appsettings.json | 6 ++++ 5 files changed, 79 insertions(+), 1 deletion(-) diff --git a/OpenAuth.App/Common/KikvisionConfig.cs b/OpenAuth.App/Common/KikvisionConfig.cs index be17291..20b2dca 100644 --- a/OpenAuth.App/Common/KikvisionConfig.cs +++ b/OpenAuth.App/Common/KikvisionConfig.cs @@ -22,4 +22,21 @@ namespace OpenAuth.App.Common /// public string SecretKey { get; set; } } + + public class KikvisionConfig2 + { + /// + /// 综合安防管理平台 url + /// + public string Url { get; set; } + public int Port { get; set; } + /// + /// AppKey + /// + public string AppKey { get; set; } + /// + /// SecretKey + /// + public string SecretKey { get; set; } + } } diff --git a/OpenAuth.App/ServiceApp/FireManagement/FireManagementApp.cs b/OpenAuth.App/ServiceApp/FireManagement/FireManagementApp.cs index 16f7e34..1e43bdd 100644 --- a/OpenAuth.App/ServiceApp/FireManagement/FireManagementApp.cs +++ b/OpenAuth.App/ServiceApp/FireManagement/FireManagementApp.cs @@ -44,14 +44,16 @@ namespace OpenAuth.App.ServiceApp.FireManagement private ClientWebSocket _socket; private IConfiguration _configuration; IOptions _options; + IOptions _options2; IOptions _jpoptions; - public FireManagementApp(IConfiguration configuration, IOptions options, + public FireManagementApp(IConfiguration configuration, IOptions options, IOptions options2, IOptions jpoptions, ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) { _auth = auth; _options = options; + _options2 = options2; _configuration = configuration; _jpoptions = jpoptions; } @@ -1220,6 +1222,38 @@ namespace OpenAuth.App.ServiceApp.FireManagement return "fail"; } + /// + /// 获取单个设备的视频流---海康平台2 + /// + /// 视频标识 + /// + [HttpPost] + [AllowAnonymous] + public string GetPreviewURLs2(string cameraIndexCode, string protocol) + { + HttpUtillib.SetPlatformInfo(_options2.Value.AppKey, _options2.Value.SecretKey, _options2.Value.Url, + _options2.Value.Port, true); + + var obj = new + { + cameraIndexCode, + streamType = 0, + protocol = protocol, + transmode = 1, + expand = "transcode=0", + streamform = "ps" + }; + string body = JsonConvert.SerializeObject(obj); + string uri = "/artemis/api/video/v2/cameras/previewURLs"; + byte[] result = HttpUtillib.HttpPost(uri, body, 15, 1); + if (null != result) + { + return Encoding.UTF8.GetString(result); + } + + return "fail"; + } + #endregion #region 人员类型统计 diff --git a/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FireManagementController.cs b/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FireManagementController.cs index 58bc11c..dc537e5 100644 --- a/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FireManagementController.cs +++ b/OpenAuth.WebApi/Controllers/ServiceControllers/FireManagement/FireManagementController.cs @@ -579,6 +579,26 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement } + + /// + /// 获取视频流---海康平台2 + /// + /// + /// + [HttpGet] + [AllowAnonymous] + public string GetPreviewURLs2(string deviceCode, string protocol) + { + try + { + return _app.GetPreviewURLs2(deviceCode, protocol); + } + catch (Exception ex) + { + return ex.Message.ToString(); + } + } + #region 人员类型统计查询 [HttpGet] [AllowAnonymous] diff --git a/OpenAuth.WebApi/Startup.cs b/OpenAuth.WebApi/Startup.cs index f8e4a12..c3fe8c5 100644 --- a/OpenAuth.WebApi/Startup.cs +++ b/OpenAuth.WebApi/Startup.cs @@ -309,6 +309,7 @@ namespace OpenAuth.WebApi #endregion #region 配置文件 services.Configure(Configuration.GetSection("Hik")); + services.Configure(Configuration.GetSection("Hik2")); services.Configure(Configuration.GetSection("JPushClient")); #endregion diff --git a/OpenAuth.WebApi/appsettings.json b/OpenAuth.WebApi/appsettings.json index 91505c5..903431c 100644 --- a/OpenAuth.WebApi/appsettings.json +++ b/OpenAuth.WebApi/appsettings.json @@ -80,6 +80,12 @@ "AppKey": "23604396", "SecretKey": "NZJ8L3bxCOOV6rtTFjsx" }, + "Hik2": { + "Url": "223.99.16.253", + "Port": 1443, + "AppKey": "28135251", + "SecretKey": "V5nOdrZ7llDeNVP3KHX4" + }, "JPushClient": { "AppKey": "bfee2a863eccbb852baa9140", "MasterSecret": "019f8665e581318dfcbac060"