From 5bf81b5138ede7fef5e5a376236fa06a1eb54daf Mon Sep 17 00:00:00 2001 From: zzh <1368735060@qq.com> Date: Tue, 6 Oct 2026 10:39:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20OpenAPI=20=E8=BD=A8=E8=BF=B9/=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=A1=A5=20Swagger=20=E8=AF=B7=E6=B1=82=E4=BD=93=20sc?= =?UTF-8?q?hema?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FromBody 仅用于文档展示,验签仍读原始 Body。 Co-authored-by: Cursor --- .../Dtos/OpenApi/OpenApiQueryDtos.cs | 5 +++++ .../Services/OpenApi/OpenApiService.cs | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Oms.Application/Dtos/OpenApi/OpenApiQueryDtos.cs b/src/Oms.Application/Dtos/OpenApi/OpenApiQueryDtos.cs index a1299f9..90b6e26 100644 --- a/src/Oms.Application/Dtos/OpenApi/OpenApiQueryDtos.cs +++ b/src/Oms.Application/Dtos/OpenApi/OpenApiQueryDtos.cs @@ -5,17 +5,22 @@ namespace Oms.Application.Dtos.OpenApi; /// public class OpenApiOrderLookupInput { + /// 客户单号。与 serviceNo / trackNo 至少填一项;同时传时优先 clientNo。 public string? ClientNo { get; set; } + /// 服务单号(OMS 运单号)。 public string? ServiceNo { get; set; } + /// 跟踪号。 public string? TrackNo { get; set; } } +/// 查询轨迹入参。 public class OpenApiTrackQueryInput : OpenApiOrderLookupInput { } +/// 按附件类型获取文件入参。 public class OpenApiFilesGetInput : OpenApiOrderLookupInput { /// diff --git a/src/Oms.Application/Services/OpenApi/OpenApiService.cs b/src/Oms.Application/Services/OpenApi/OpenApiService.cs index 6d661e3..bba414f 100644 --- a/src/Oms.Application/Services/OpenApi/OpenApiService.cs +++ b/src/Oms.Application/Services/OpenApi/OpenApiService.cs @@ -79,10 +79,13 @@ public class OpenApiService : ApplicationService /// [AllowAnonymous] [HttpPost("/openapi/parcel/create")] + [Consumes("application/json")] + [Produces("application/json")] public async Task> CreateParcelAsync( [FromHeader(Name = CustomerOpenApiAuthHelper.AppKeyHeaderName)] string? appKey, [FromHeader(Name = CustomerOpenApiAuthHelper.TimestampHeaderName)] string? timestamp, - [FromHeader(Name = CustomerOpenApiAuthHelper.SignHeaderName)] string? sign) + [FromHeader(Name = CustomerOpenApiAuthHelper.SignHeaderName)] string? sign, + [FromBody] OpenApiParcelCreateInput? requestBody) { try { @@ -120,10 +123,13 @@ public class OpenApiService : ApplicationService /// [AllowAnonymous] [HttpPost("/openapi/track/query")] + [Consumes("application/json")] + [Produces("application/json")] public async Task> QueryTrackAsync( [FromHeader(Name = CustomerOpenApiAuthHelper.AppKeyHeaderName)] string? appKey, [FromHeader(Name = CustomerOpenApiAuthHelper.TimestampHeaderName)] string? timestamp, - [FromHeader(Name = CustomerOpenApiAuthHelper.SignHeaderName)] string? sign) + [FromHeader(Name = CustomerOpenApiAuthHelper.SignHeaderName)] string? sign, + [FromBody] OpenApiTrackQueryInput? requestBody) { try { @@ -168,10 +174,13 @@ public class OpenApiService : ApplicationService /// [AllowAnonymous] [HttpPost("/openapi/files/get")] + [Consumes("application/json")] + [Produces("application/json")] public async Task> GetFilesAsync( [FromHeader(Name = CustomerOpenApiAuthHelper.AppKeyHeaderName)] string? appKey, [FromHeader(Name = CustomerOpenApiAuthHelper.TimestampHeaderName)] string? timestamp, - [FromHeader(Name = CustomerOpenApiAuthHelper.SignHeaderName)] string? sign) + [FromHeader(Name = CustomerOpenApiAuthHelper.SignHeaderName)] string? sign, + [FromBody] OpenApiFilesGetInput? requestBody) { try {