This commit is contained in:
xiaolipro 2025-07-26 10:31:14 +08:00
parent ba12588bcd
commit 259113ad1e

View File

@ -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<IForwardFlow>()
.FirstOrDefault(x => x.GetType().Name == flowCode)?? throw new BusinessException("未找到流程模版,请联系开发");
var flow = serviceProvider.GetServices<IForwardFlow>()
.FirstOrDefault(x => x.GetType().Name == flowCode);
if (flow == null)
throw new BusinessException(message: "找不到接口转发流程" + flowCode);
return flow;
}
/// <summary>
@ -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);
}