From 259113ad1e7197c67dde1c1fa015ded95931c8d3 Mon Sep 17 00:00:00 2001 From: xiaolipro <2357729423@qq.com> Date: Sat, 26 Jul 2025 10:31:14 +0800 Subject: [PATCH] append --- .../Services/InterfaceForwardCommon.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs b/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs index 3588790..99d023a 100644 --- a/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs +++ b/src/InterfaceForward.Application/Services/InterfaceForwardCommon.cs @@ -125,8 +125,6 @@ public class InterfaceForwardCommon( Debug.Assert(context.TargetInterface.FlowCode != null, "context.TargetInterface.FlowCode != null"); var flow = GetForwardFlow(context.TargetInterface.FlowCode); - if (flow == default) - throw new BusinessException(message: "找不到接口转发流程" + context.TargetInterface.FlowCode); _flows.Add(context.TargetInterface.Code, flow); res.Add(context); @@ -141,8 +139,11 @@ public class InterfaceForwardCommon( // 优先用服务商接口指定流程,其次使用服务商的,再其次是默认的 public IForwardFlow GetForwardFlow(string flowCode) { - return serviceProvider.GetServices() - .FirstOrDefault(x => x.GetType().Name == flowCode)?? throw new BusinessException("未找到流程模版,请联系开发"); + var flow = serviceProvider.GetServices() + .FirstOrDefault(x => x.GetType().Name == flowCode); + if (flow == null) + throw new BusinessException(message: "找不到接口转发流程" + flowCode); + return flow; } /// @@ -205,10 +206,6 @@ public class InterfaceForwardCommon( { Debug.Assert(cacheContext.ServiceProviderAuthInterface != null, "cacheContext.ServiceProviderAuthInterface != null"); var flow = GetForwardFlow(cacheContext.ServiceProviderAuthInterface.TargetInterface.FlowCode!); - if (flow == default) - throw new BusinessException(message: "找不到接口转发流程" + - cacheContext.ServiceProviderAuthInterface.TargetInterface - .FlowCode); _flows.Add(cacheContext.ServiceProviderAuthInterface.TargetInterface.Code, flow); }