From f0d96c0cb3584d050f314994c475ed64f8d06b42 Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Thu, 15 Jan 2026 12:12:20 +0800 Subject: [PATCH] =?UTF-8?q?optimize=EF=BC=9A=E4=BC=98=E5=8C=96=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=95=86mq=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Rabbit/BatchForwardEventHandler.cs | 5 +++++ .../Services/InterfaceForwardCommon.cs | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs b/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs index 1116208..28863f4 100644 --- a/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs +++ b/src/InterfaceForward.Application/Rabbit/BatchForwardEventHandler.cs @@ -90,6 +90,11 @@ public class BatchForwardEventHandler( { var data = System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(replayEvent); rabbitClient.Publish(GlobalConst.InterfaceRelayExchange, @event.ResSubscribeName, data); + + context.ServiceProviderRequestLog.Response2 = replayEvent.ToJson(); + + // 写服务商日志 + await logRepository.AddLogAsync(context.ServiceProviderRequestLog); } } } \ No newline at end of file diff --git a/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs b/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs index 8e62980..04e95c6 100644 --- a/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs +++ b/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs @@ -362,10 +362,6 @@ public class InterfaceForwardCommon( if (isMulti) return response; // 一对多不在这映射 var res = await flow.OutParamRestructure(context, response); - if (context.Feature.IsWait) - { - context.ServiceProviderRequestLog.Response2 = res.ToJson(); - } return res; } @@ -386,8 +382,12 @@ public class InterfaceForwardCommon( // 关联当前服务商日志 logRepository.ServiceProviderRequestLog = context.ServiceProviderRequestLog; - // 写服务商日志 - await logRepository.AddLogAsync(context.ServiceProviderRequestLog); + + if (!context.Feature.IsWait) // 批量case服务商日志延迟到 handle中处理 + { + // 写服务商日志 + await logRepository.AddLogAsync(context.ServiceProviderRequestLog); + } } }