yg 3 meses atrás
pai
commit
c71ea162d0

+ 4 - 0
AdService/Controllers/AdController.cs

@@ -22,6 +22,10 @@ namespace AdService.Controllers
         {
             try
             {
+                if (!dtos.Any())
+                {
+                    return new AjaxResult<AdcResultDto>();
+                }
                 var res = await AdcService.Instance.StartTestAsync(dtos);
 
                 return Success(res);

+ 1 - 0
AdService/Program.cs

@@ -7,6 +7,7 @@ builder.Services.AddControllers();
 builder.Services.AddEndpointsApiExplorer();
 builder.Services.AddSwaggerGen();
 
+
 var app = builder.Build();
 
 // Configure the HTTP request pipeline.

+ 1 - 1
AdService/Service/AdReportService.cs

@@ -27,7 +27,7 @@ namespace AdService.Service
                         SwaggerAddr="",
                         ReportType = 0,
                     };
-                    // var res = await HttpHelper.PostRequestAsync<CpuCgResDto>("" + "SvrReport/Report", dto);
+                    var res = await HttpHelper.PostRequestAsync<CpuCgResDto>("" + "SvrReport/Report", dto);
                     await Task.Delay(3 * 1000, stoppingToken);
                 }
             }, stoppingToken);

+ 1 - 0
DW5S.App/UserControl/CtrlADTask.Designer.cs

@@ -113,6 +113,7 @@
             btnStart.StyleController = layoutControl1;
             btnStart.TabIndex = 9;
             btnStart.Text = "启动任务";
+            btnStart.Click += btnStartaAD_Click;
             // 
             // btnSerach
             // 

+ 23 - 1
DW5S.App/UserControl/CtrlADTask.cs

@@ -1,4 +1,7 @@
-using DevExpress.Mvvm.Native;
+using DevExpress.CodeParser;
+using DevExpress.Mvvm.Native;
+using DevExpress.XtraPrinting;
+using DW5S.DTO;
 using DW5S.Entity;
 using DW5S.Repostory;
 using DW5S.ViewModel;
@@ -102,5 +105,24 @@ namespace DW5S.App.UserControl
             }
 
         }
+
+
+        private async void btnStartaAD_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                List<AdCard> adCard = new List<AdCard>();
+
+                var res = await HttpHelper.PostRequestAsync<List<AdCard>>("http://127.0.0.1:7070/api/Ad/StartAd", adCard);
+                IocContainer.Logger.Information("启动采集任务成功");
+            }
+            catch (Exception ex)
+            {
+                IocContainer.Logger.Error(ex, "启动采集任务异常");
+                DxHelper.MsgBoxHelper.ShowError("启动采集任务异常");
+
+            }
+
+        }
     }
 }