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#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
#region << 版 本 注 释 >>
/*--------------------------------------------------------------------
* 版权所有 (c) 2026 WenJY 保留所有权利。
* CLR版本4.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";
}
}
}