You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.0 KiB
C#

using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* (c) 2026 WenJY
* CLR4.0.30319.42000
* T14-GEN3-7895
* Sln.Wcs.Api.Sdk.Config
* f241e008-1718-4e55-824f-703286c352d6
*
* WenJY
*
* 2026-02-25 13:59:37
* V1.0.0
*
*
*--------------------------------------------------------------------
*
*
*
*
* V1.0.0
*--------------------------------------------------------------------*/
#endregion << 版 本 注 释 >>
namespace Sln.Wcs.Api.Sdk.Config
{
public class HikRoBotConfig
{
public readonly string api = "";
public readonly string partnerId;
public readonly string accesskey;
public readonly string secretkey;
public readonly string version;
public readonly string test;
/// <summary>
/// 注入海康 SDK 配置参数
/// </summary>
/// <param name="configuration"></param>
/// <exception cref="Exception"></exception>IConfiguration configuration
public HikRoBotConfig(IConfiguration configuration)
{
if (string.IsNullOrEmpty(configuration["sdk_api"]))
{
throw new Exception("sdk_api 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_partner_id"]))
{
throw new Exception("sdk_partner_id 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_accesskey"]))
{
throw new Exception("sdk_accesskey 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_secretkey"]))
{
throw new Exception("sdk_secretkey 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_partner_id"]))
{
throw new Exception("sdk_partner_id 配置不正确,请检查Apollo配置.");
}
if (string.IsNullOrEmpty(configuration["sdk_version"]))
{
throw new Exception("sdk_version 配置不正确,请检查Apollo配置.");
}
api = configuration["sdk_api"];
accesskey = configuration["sdk_accesskey"];
secretkey = configuration["sdk_secretkey"];
version = configuration["sdk_version"];
test = configuration["sdk_test"];
// api = "http://www.fangcang.com/tmc-hub/queryProductDetail";
// partnerId = "P10000408";
// accesskey = "";
// secretkey = "lwdmmuVfbKLRhgihMycWTz6T";
// version = "1.0.0";
}
}
}