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); + } } }