public YilianyunService(IHttpClientFactory _httpClientFactory
                         , IOptions <YilianyunConfig> configOptions
                         , IYilianyunSdkHook yilianyunSdkHook)
 {
     _yilianyunConfig = configOptions?.Value;
     if (yilianyunSdkHook != null)
     {
         _yilianyunSdkHook = yilianyunSdkHook;
         _yilianyunConfig  = _yilianyunSdkHook.GetClientConfig();
     }
     if (_yilianyunConfig == null)
     {
         throw new Exception("打印机配置错误");
     }
     _httpClient             = _httpClientFactory.CreateClient("yilianyun");
     _httpClient.BaseAddress = new Uri(_yilianyunConfig.ApiUrl ?? "https://open-api.10ss.net");
     _httpClient.Timeout     = TimeSpan.FromSeconds(_yilianyunConfig.Timeout ?? 30);
 }
Example #2
0
 public DefaultYilianyunSdkHook(IOptions <YilianyunConfig> configOptions)
 {
     _yilianyunConfig = configOptions?.Value;
 }