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

44 lines
1.4 KiB

using BBWY.Common.Http;
using BBWY.Server.Model;
using Microsoft.Extensions.Options;
using System.Collections.Generic;
using System.Linq;
namespace BBWY.Server.Business
{
public class BasePlatformRelayBusiness
{
protected RestApiService restApiService;
protected GlobalConfig globalConfig;
private YunDingBusiness yunDingBusiness;
public BasePlatformRelayBusiness(RestApiService restApiService, IOptions<GlobalConfig> options, YunDingBusiness yunDingBusiness)
{
this.restApiService = restApiService;
this.globalConfig = options.Value;
this.yunDingBusiness = yunDingBusiness;
}
/// <summary>
/// 获取指定平台(云鼎/聚石塔/等)接口地址
/// </summary>
/// <param name="platform"></param>
/// <returns></returns>
protected string GetPlatformRelayAPIHost(Enums.Platform platform)
{
return globalConfig.PlatformAPIs.FirstOrDefault(p => p.Platform == platform).APIHost;
}
protected string GetYunDingKey()
{
return yunDingBusiness.GetKey();
}
protected IDictionary<string, string> GetYunDingRequestHeader()
{
return new Dictionary<string, string>()
{
{ "YunDingKey", GetYunDingKey()}
};
}
}
}