From f7be966adc8c834083ef52cc33d1c01e22e1eff6 Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Wed, 1 Jul 2026 11:58:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(xhs):=20task/report=20=E4=B8=8E=20task/canc?= =?UTF-8?q?el=20=E8=BF=94=E5=9B=9E=20JSON=20=E5=93=8D=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免 Agent 客户端解析空 body 报「非 JSON 响应」导致任务上报失败。 Co-authored-by: Cursor --- src/Oms.Application/Dtos/Xhs/XhsDtos.cs | 5 +++++ src/Oms.Application/Services/Xhs/XhsTaskService.cs | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Oms.Application/Dtos/Xhs/XhsDtos.cs b/src/Oms.Application/Dtos/Xhs/XhsDtos.cs index c1ed96c..7bd4919 100644 --- a/src/Oms.Application/Dtos/Xhs/XhsDtos.cs +++ b/src/Oms.Application/Dtos/Xhs/XhsDtos.cs @@ -136,6 +136,11 @@ public class XhsTaskReportInput public string? ErrorMessage { get; set; } } +public class XhsTaskReportOutput +{ + public bool Ok { get; set; } = true; +} + public class XhsTaskListInput : XhsPageInput { public string? Status { get; set; } diff --git a/src/Oms.Application/Services/Xhs/XhsTaskService.cs b/src/Oms.Application/Services/Xhs/XhsTaskService.cs index 3df157b..40fcafb 100644 --- a/src/Oms.Application/Services/Xhs/XhsTaskService.cs +++ b/src/Oms.Application/Services/Xhs/XhsTaskService.cs @@ -43,7 +43,7 @@ public class XhsTaskService : ApplicationService } [HttpPost("/xhs/task/report")] - public async Task ReportAsync(XhsTaskReportInput input) + public async Task ReportAsync(XhsTaskReportInput input) { var customerId = await OmsSessionHelper.ResolveXhsCustomerIdAsync(CustomerRepository, CurrentUser); var task = await TaskRepository.FirstOrDefaultAsync(x => x.Id == input.TaskId); @@ -80,6 +80,7 @@ public class XhsTaskService : ApplicationService await TaskRepository.UpdateAsync(task); await SyncPublishRecordAsync(task, status, input); await SyncAnalysisSessionAsync(task, status, input); + return new XhsTaskReportOutput(); } [HttpPost("/xhs/task/list")] @@ -104,7 +105,7 @@ public class XhsTaskService : ApplicationService } [HttpPost("/xhs/task/cancel")] - public async Task CancelAsync(XhsTaskCancelInput input) + public async Task CancelAsync(XhsTaskCancelInput input) { var customerId = await OmsSessionHelper.ResolveXhsCustomerIdAsync(CustomerRepository, CurrentUser); var task = await TaskRepository.FirstOrDefaultAsync(x => x.Id == input.TaskId); @@ -121,6 +122,7 @@ public class XhsTaskService : ApplicationService task.Status = XhsTaskStatusCodes.Cancelled; task.FinishedAt = DateTime.Now; await TaskRepository.UpdateAsync(task); + return new XhsTaskReportOutput(); } private async Task SyncAnalysisSessionAsync(XhsTask task, string status, XhsTaskReportInput input)