Selaa lähdekoodia

改成单个new

devin.zhu@doverfs.com 1 vuosi sitten
vanhempi
commit
34742cd37d
1 muutettua tiedostoa jossa 9 lisäystä ja 5 poistoa
  1. 9 5
      src/MS.WebApi/Controllers/ReportController.cs

+ 9 - 5
src/MS.WebApi/Controllers/ReportController.cs

@@ -144,37 +144,41 @@ namespace MS.WebApi.Controllers
             var buids =await _AccountService.GetBuids();
             _logger.LogInformation($"buids 个数 {buids}  time:{DateTime.Now}");
             var bassAddress = _configuration.GetSection(ReportServerUrl).Value;
-            HttpClient httpClient = new HttpClient();
-            httpClient.BaseAddress=new Uri(bassAddress);
+          
             foreach (var buid in buids)
             {
                 //日执行
                 if (type == 1 || type == 9999)
                 {
-                    
+                    HttpClient httpClient = new HttpClient();
+                    httpClient.BaseAddress = new Uri(bassAddress);
                     var url = $"/api/Report/BusinessScopeReportTimeJob?pageNumber=0&pageCount=5&reportType=day&startTime={DateTime.Now.AddDays(-5)}&key=TK2024Cache&buid={buid}";
                     if (type == 9999)
                     {
                         url = $"/api/Report/BusinessScopeReportTimeJob?pageNumber=0&pageCount=80&reportType=day&startTime={DateTime.Now.AddMonths(-3)}&key=TK2024Cache&buid={buid}";
                     }
                     var result=await httpClient.GetAsync(url);
-                    _logger.LogInformation($"{buid}日报表 统计执行完成 {result.StatusCode}-{result.Content.ToString()}  time:{DateTime.Now}");
+                    _logger.LogInformation($"{buid}日报表 统计执行完成 {result.StatusCode}-{await result.Content.ReadAsStringAsync()}  time:{DateTime.Now}");
                 }
                 //周执行
                 if (type == 2 || type == 9999)
                 {
+                    HttpClient httpClient = new HttpClient();
+                    httpClient.BaseAddress = new Uri(bassAddress);
                     var url = $"/api/Report/BusinessScopeReportTimeJob?pageNumber=0&pageCount=2&reportType=week&startTime={DateTime.Now.AddDays(-20)}&key=TK2024Cache&buid={buid}";
                     if (type == 9999)
                     {
                         url = $"/api/Report/BusinessScopeReportTimeJob?pageNumber=0&pageCount=20&reportType=week&startTime={DateTime.Now.AddMonths(-6)}&key=TK2024Cache&buid={buid}";
                     }
                     var result = await httpClient.GetAsync(url);
-                    _logger.LogInformation($"{buid}周报表 统计执行完成 {result.StatusCode}-{result.Content.ToString()}  time:{DateTime.Now}");
+                    _logger.LogInformation($"{buid} week 周报表 统计执行完成 {result.StatusCode}-{result.Content.ToString()}  time:{DateTime.Now}");
 
                 }
                 //月执行
                 if (type == 3 || type == 9999)
                 {
+                    HttpClient httpClient = new HttpClient();
+                    httpClient.BaseAddress = new Uri(bassAddress);
                     var url = $"/api/Report/BusinessScopeReportTimeJob?pageNumber=0&pageCount=2&reportType=month&startTime={DateTime.Now.AddMonths(-2)}&key=TK2024Cache&buid={buid}";
                     if (type == 9999)
                     {