public WechatMiniProgramService(IHttpClientFactory _httpClientFactory , IWechatMiniProgramSdkHook WechatMiniProgramSdkHook ) { _sdkHook = WechatMiniProgramSdkHook; _apiConfig = WechatMiniProgramSdkHook.GetConfig(); if (_apiConfig == null) throw new Exception("WechatMiniProgram not configured"); _httpClient = _httpClientFactory.CreateClient("WechatMiniProgram"); if (!string.IsNullOrWhiteSpace(_apiConfig.ApiUrl)) _httpClient.BaseAddress = new Uri(_apiConfig.ApiUrl); if (_apiConfig.Timeout.HasValue) _httpClient.Timeout = TimeSpan.FromSeconds(_apiConfig.Timeout.Value); }
public DefaultWechatMiniProgramSdkHook(IOptions <WechatMiniProgramConfig> options) { _apiConfig = options.Value; }