Browse Source

修复接口方法排序失效的问题

zhontai 2 years ago
parent
commit
ddd56a6f76
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/platform/ZhonTai.Admin/Core/HostApp.cs

+ 2 - 1
src/platform/ZhonTai.Admin/Core/HostApp.cs

@@ -52,6 +52,7 @@ using ZhonTai.Admin.Core.Middlewares;
 using ZhonTai.Admin.Core.Dto;
 using ZhonTai.DynamicApi.Attributes;
 using System.Text.RegularExpressions;
+using Swashbuckle.AspNetCore.SwaggerGen;
 
 namespace ZhonTai.Admin.Core;
 
@@ -397,7 +398,7 @@ public class HostApp
                 options.OrderActionsBy(apiDesc =>
                 {
                     var order = 0;
-                    var objOrderAttribute = apiDesc.ActionDescriptor.EndpointMetadata.FirstOrDefault(x => x is OrderAttribute);
+                    var objOrderAttribute = apiDesc.CustomAttributes().FirstOrDefault(x => x is OrderAttribute);
                     if (objOrderAttribute != null)
                     {
                         var orderAttribute = objOrderAttribute as OrderAttribute;