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 options, YunDingBusiness yunDingBusiness) { this.restApiService = restApiService; this.globalConfig = options.Value; this.yunDingBusiness = yunDingBusiness; } /// /// 获取指定平台(云鼎/聚石塔/等)接口地址 /// /// /// protected string GetPlatformRelayAPIHost(Enums.Platform platform) { return globalConfig.PlatformAPIs.FirstOrDefault(p => p.Platform == platform).APIHost; } protected string GetYunDingKey() { return yunDingBusiness.GetKey(); } protected IDictionary GetYunDingRequestHeader() { return new Dictionary() { { "YunDingKey", GetYunDingKey()} }; } } }