|
@@ -37,15 +37,23 @@ public class ExportDataController : BaseController
|
|
|
if (string.IsNullOrEmpty(originalPath))
|
|
|
throw UserFriendlyException.SameMessage("无效的URL地址" + fullPath);
|
|
|
|
|
|
- var matchingEndpoint = _endpointDataSource.Endpoints
|
|
|
+ var matchingEndpoints = _endpointDataSource.Endpoints
|
|
|
.OfType<RouteEndpoint>()
|
|
|
- .FirstOrDefault(endpoint => endpoint.RoutePattern.RawText == originalPath)
|
|
|
+ .Where(endpoint => endpoint.RoutePattern.RawText == originalPath)
|
|
|
+ .ToList()
|
|
|
?? throw UserFriendlyException.SameMessage($"根据URL查询路由失败: {originalPath}");
|
|
|
+ var matchingEndpoint = matchingEndpoints.First();
|
|
|
+ if (matchingEndpoints.Count > 1)
|
|
|
+ {
|
|
|
+ matchingEndpoint = matchingEndpoints.First(m => m.DisplayName.Contains("Get"));
|
|
|
+ }
|
|
|
+ if (matchingEndpoint == null)
|
|
|
+ throw UserFriendlyException.SameMessage($"根据URL查询路由失败: {originalPath}");
|
|
|
|
|
|
var controllerName = matchingEndpoint.RoutePattern.RequiredValues["controller"]?.ToString();
|
|
|
var actionName = matchingEndpoint.RoutePattern.RequiredValues["action"]?.ToString();
|
|
|
|
|
|
- var applicationServiceType = GetApplicationServiceType(controllerName)
|
|
|
+ var applicationServiceType = GetApplicationServiceType(controllerName)
|
|
|
?? throw UserFriendlyException.SameMessage($"根据名称查找方法失败. '{controllerName}'");
|
|
|
|
|
|
var method = applicationServiceType.GetMethod(actionName);
|