diff --git a/LFlow.Base/App.cs b/LFlow.Base/App.cs index 32d6449..18873ac 100644 --- a/LFlow.Base/App.cs +++ b/LFlow.Base/App.cs @@ -6,12 +6,25 @@ namespace LFlow.Base; /// public class App { + /// + /// 服务集合 + /// internal static IServiceCollection? services; + /// + /// 服务提供者 + /// private static IServiceProvider? ServiceProvider => services?.BuildServiceProvider(); + /// + /// 获取服务 + /// + /// + /// public static T? GetService() { return ServiceProvider!.GetService(); } - + /// + /// 子服务程序集 + /// public static List SubServiceAssembly = []; } diff --git a/LFlow.Base/Base.xml b/LFlow.Base/Base.xml index aa64fcc..96e4fc5 100644 --- a/LFlow.Base/Base.xml +++ b/LFlow.Base/Base.xml @@ -9,6 +9,28 @@ 程序对象 + + + 服务集合 + + + + + 服务提供者 + + + + + 获取服务 + + + + + + + 子服务程序集 + + 默认的增删改查仓储 @@ -16,6 +38,17 @@ + + + 数据库连接客户端 + + + + + 构造函数 + + + 根据ID删除对象 @@ -68,6 +101,45 @@ Route("api/[controller]/[action]") ApiController + + + 成功返回 + + + + + + + + 成功返回(分页) + + + + + + + + + + + 失败返回 + + + + + + + + + + 失败返回(分页) + + + + + + + 控制器接口 @@ -93,6 +165,12 @@ 模块接口 + + + 配置模块 + + + 通用的仓库对象接口 @@ -119,6 +197,7 @@ 保存与更新 + @@ -127,6 +206,7 @@ + @@ -146,14 +226,35 @@ 服务接口 + + + + + - + + + + 入口 + + + + + + 配置SqlSugar + + 从子文件夹中加载DLL + + + 配置DLL加载器 + + 控制器模型约定 @@ -171,6 +272,88 @@ + + + 数据 + + + + + 构造函数 + + + + + 构造函数 + + + + + + + + + 是否成功 + + + + + 消息 + + + + + 状态码 + + + + + 成功返回 + + + + + + + + + 失败返回 + + + + + + + + CodeFirst + + + + + 类型集合 + + + + + 添加类型 + + + + + + 初始化表 + + + + + 初始化数据库种子 + + + + + 映射器 + + 将一个对象映射到另一个对象 @@ -179,6 +362,19 @@ + + + 将一个数据模型映射到另一个对象 + + + + + + + + 对象转换为where条件 + + 将IModel对象转换为where条件 @@ -192,6 +388,68 @@ + + + 数据 + + + + + 总行数 + + + + + 当前页 + + + + + 每页行数 + + + + + 构造函数 + + + + + 构造函数 + + + + + + + + + + + + 成功返回 + + + + + + + + + + + + 失败返回 + + + + + + + + 注册模块 + + 注册所有模型 diff --git a/LFlow.Base/Default/DefaultCurdRepo.cs b/LFlow.Base/Default/DefaultCurdRepo.cs index 1e4b77b..24855f7 100644 --- a/LFlow.Base/Default/DefaultCurdRepo.cs +++ b/LFlow.Base/Default/DefaultCurdRepo.cs @@ -10,7 +10,14 @@ namespace LFlow.Base.Default; /// public abstract class DefaultCurdRepo : IRepo where T : class, IDataModel, new() { + /// + /// 数据库连接客户端 + /// private readonly ISqlSugarClient _client; + /// + /// 构造函数 + /// + /// public DefaultCurdRepo(ISqlSugarClient client) { _client = client; diff --git a/LFlow.Base/Interfaces/BaseController.cs b/LFlow.Base/Interfaces/BaseController.cs index 8b8ae54..4857d80 100644 --- a/LFlow.Base/Interfaces/BaseController.cs +++ b/LFlow.Base/Interfaces/BaseController.cs @@ -11,19 +11,49 @@ namespace LFlow.Base.Interfaces; [ApiController] public abstract class BaseController : ControllerBase, IController { + /// + /// 成功返回 + /// + /// + /// + /// protected virtual ApiResult Success(T? data) where T : class, new() { return ApiResult.SuccessResult(data); } + /// + /// 成功返回(分页) + /// + /// + /// + /// + /// + /// + /// protected virtual PagedApiResult Success(T? data, int totalCount, int pageIndex, int pageSize) where T : class, new() { return PagedApiResult.SuccessResult(data, totalCount, pageIndex, pageSize); } - + /// + /// 失败返回 + /// + /// + /// + /// + /// + /// protected virtual ApiResult Fail(T? data, string errorMsg, int errCode) where T : class, new() { return ApiResult.FailResult(errorMsg, errCode); } + /// + /// 失败返回(分页) + /// + /// + /// + /// + /// + /// protected virtual PagedApiResult? PagedFail(T? data, string errorMsg, int errCode) where T : class, new() { return PagedApiResult.FailResult(errorMsg, errCode); diff --git a/LFlow.Base/Interfaces/IModule.cs b/LFlow.Base/Interfaces/IModule.cs index da70537..85b406f 100644 --- a/LFlow.Base/Interfaces/IModule.cs +++ b/LFlow.Base/Interfaces/IModule.cs @@ -6,5 +6,9 @@ namespace LFlow.Base.Interfaces; /// public interface IModule { + /// + /// 配置模块 + /// + /// void ConfigureModule(IServiceCollection services); } diff --git a/LFlow.Base/Interfaces/IRepo.cs b/LFlow.Base/Interfaces/IRepo.cs index 681d11b..a311a03 100644 --- a/LFlow.Base/Interfaces/IRepo.cs +++ b/LFlow.Base/Interfaces/IRepo.cs @@ -23,6 +23,7 @@ public interface IRepo where T : IDataModel /// 保存与更新 /// /// + /// /// T SaveOrUpdate(T entity, bool isUpdate); /// @@ -30,6 +31,7 @@ public interface IRepo where T : IDataModel /// /// /// + /// /// List GetAll(int pageIndex, int pageSize, ref int pageTotal); diff --git a/LFlow.Base/Interfaces/IService.cs b/LFlow.Base/Interfaces/IService.cs index ec87f50..a518f1f 100644 --- a/LFlow.Base/Interfaces/IService.cs +++ b/LFlow.Base/Interfaces/IService.cs @@ -1,8 +1,7 @@ namespace LFlow.Base.Interfaces; /// -/// ӿ -/// -/// +/// 服务接口 +/// public interface IService// where T : class, IModel, new() { diff --git a/LFlow.Base/Program.cs b/LFlow.Base/Program.cs index 0b0c195..39b1225 100644 --- a/LFlow.Base/Program.cs +++ b/LFlow.Base/Program.cs @@ -11,9 +11,15 @@ using SqlSugar; using System.Reflection; namespace LFlow.Base; +/// +/// +/// public static class Program { - + /// + /// 入口 + /// + /// public static void Main(string[] args) { @@ -47,8 +53,10 @@ public static class Program builder.Services.AddEndpointsApiExplorer(); builder.Services.AddHttpContextAccessor(); + builder.Services.AddResponseCompression(); Log.Logger.Information("ConfigureSqlSugar"); + builder.Services.ConfigureSqlSugar(); builder.Services.AddControllers(c => @@ -87,6 +95,8 @@ public static class Program }); }); }); + + // 配置跨域策略 builder.Services.AddCors(options => { @@ -149,7 +159,7 @@ public static class Program } // 在启动后调用Sqlsugar进行CodeFirst // 挂载启动后事件 - app.Services.GetRequiredService().ApplicationStarted.Register(async () => + app.Services.GetRequiredService().ApplicationStarted.Register(() => { Log.Logger.Information("ApplicationStarted"); CodeFirst.InitTable(); @@ -170,6 +180,10 @@ public static class Program app.Run(); } + /// + /// 配置SqlSugar + /// + /// public static void ConfigureSqlSugar(this IServiceCollection services) { services.AddSingleton(s => @@ -260,6 +274,9 @@ public static class Program } + /// + /// 配置DLL加载器 + /// public static void ConfigDllLoader() { AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => diff --git a/LFlow.Base/Utils/ApiResult.cs b/LFlow.Base/Utils/ApiResult.cs index 9fb7171..ae7a925 100644 --- a/LFlow.Base/Utils/ApiResult.cs +++ b/LFlow.Base/Utils/ApiResult.cs @@ -7,15 +7,26 @@ [Serializable] public class ApiResult where T : class, new() { + /// + /// 数据 + /// public T? Data { get; set; } - + /// + /// 构造函数 + /// public ApiResult() { } - + /// + /// 构造函数 + /// + /// + /// + /// + /// public ApiResult(bool success, string message, int code, T? data) { Success = success; @@ -23,26 +34,44 @@ public class ApiResult where T : class, new() Code = code; Data = data; } - + /// + /// 是否成功 + /// public bool Success { get; set; } - + /// + /// 消息 + /// public string? Message { get; set; } - + /// + /// 状态码 + /// public int? Code { get; set; } - + /// + /// 成功返回 + /// + /// + /// + /// + /// public static ApiResult SuccessResult(T? data, string message = "操作成功", int code = 200) { return new ApiResult(true, message, code, data); } + /// + /// 失败返回 + /// + /// + /// + /// public static ApiResult FailResult(string message = "操作失败", int code = 500) { return new ApiResult(false, message, code, default); diff --git a/LFlow.Base/Utils/CodeFirst.cs b/LFlow.Base/Utils/CodeFirst.cs index 25cb83d..65dfe03 100644 --- a/LFlow.Base/Utils/CodeFirst.cs +++ b/LFlow.Base/Utils/CodeFirst.cs @@ -2,15 +2,27 @@ using SqlSugar; using System.Collections.Concurrent; namespace LFlow.Base.Utils; - +/// +/// CodeFirst +/// public static class CodeFirst { - // 线程安全的类型列表 - private static readonly ConcurrentBag _types = new(); + + /// + /// 类型集合 + /// + private static readonly ConcurrentBag _types = []; + /// + /// 添加类型 + /// + /// public static void AddType(Type type) { _types.Add(type); } + /// + /// 初始化表 + /// internal static void InitTable() { var logger = App.GetService()!; @@ -22,6 +34,9 @@ public static class CodeFirst } } + /// + /// 初始化数据库种子 + /// internal static void InitDBSeed() { //TODO: Seed data diff --git a/LFlow.Base/Utils/Mapper.cs b/LFlow.Base/Utils/Mapper.cs index d5ba2b0..1516847 100644 --- a/LFlow.Base/Utils/Mapper.cs +++ b/LFlow.Base/Utils/Mapper.cs @@ -2,7 +2,9 @@ using LFlow.Base.Interfaces; using Mapster; namespace LFlow.Base.Utils; - +/// +/// 映射器 +/// public static class Mapper { /// @@ -19,6 +21,12 @@ public static class Mapper } return source.Adapt(); } + /// + /// 将一个数据模型映射到另一个对象 + /// + /// + /// + /// public static T? MapTo(this IDataModel model) { if (model == null) diff --git a/LFlow.Base/Utils/ObjectToWhereExp.cs b/LFlow.Base/Utils/ObjectToWhereExp.cs index f4ef5c7..74dde9e 100644 --- a/LFlow.Base/Utils/ObjectToWhereExp.cs +++ b/LFlow.Base/Utils/ObjectToWhereExp.cs @@ -1,7 +1,9 @@ using LFlow.Base.Interfaces; namespace LFlow.Base.Utils; - +/// +/// 对象转换为where条件 +/// public static class ObjectToWhereExp { /// diff --git a/LFlow.Base/Utils/PagedApiResult.cs b/LFlow.Base/Utils/PagedApiResult.cs index 12a8999..7da995a 100644 --- a/LFlow.Base/Utils/PagedApiResult.cs +++ b/LFlow.Base/Utils/PagedApiResult.cs @@ -7,29 +7,51 @@ [Serializable] public class PagedApiResult : ApiResult where T : class, new() { + /// + /// 数据 + /// public new T? Data { get; set; } + /// + /// 总行数 + /// public int TotalCount { get; set; } + /// + /// 当前页 + /// public int PageIndex { get; set; } - + /// + /// 每页行数 + /// public int PageSize { get; set; } - + /// + /// 构造函数 + /// public PagedApiResult() { } - + /// + /// 构造函数 + /// + /// + /// + /// + /// + /// + /// + /// public PagedApiResult(bool success, string message, int code, T? data, int totalCount, int pageIndex, int pageSize) { Success = success; @@ -40,10 +62,26 @@ public class PagedApiResult : ApiResult where T : class, new() PageIndex = pageIndex; PageSize = pageSize; } + /// + /// 成功返回 + /// + /// + /// + /// + /// + /// + /// + /// public static PagedApiResult SuccessResult(T? data, int totalCount, int pageIndex, int pageSize, string message = "操作成功", int code = 200) { return new PagedApiResult(true, message, code, data, totalCount, pageIndex, pageSize); } + /// + /// 失败返回 + /// + /// + /// + /// public static new PagedApiResult? FailResult(string message = "操作失败", int errCode = 500) { return new PagedApiResult(false, message, errCode, null, 0, 0, 0); diff --git a/LFlow.Base/Utils/RegisterModule.cs b/LFlow.Base/Utils/RegisterModule.cs index 87a9ac1..20d0973 100644 --- a/LFlow.Base/Utils/RegisterModule.cs +++ b/LFlow.Base/Utils/RegisterModule.cs @@ -1,5 +1,7 @@ namespace LFlow.Base.Utils; - +/// +/// 注册模块 +/// public static class RegisterModule { /// diff --git a/LFlow.InternalEventBus/InternalEventBus.cs b/LFlow.InternalEventBus/InternalEventBus.cs index 6dcf598..3f1f2d2 100644 --- a/LFlow.InternalEventBus/InternalEventBus.cs +++ b/LFlow.InternalEventBus/InternalEventBus.cs @@ -59,7 +59,7 @@ namespace LFlow.InternalEventBus /// public static async Task PublishAsync(string eventName, object data) { - Task.Factory.StartNew(() => Publish(eventName, data)); + await Task.Factory.StartNew(() => Publish(eventName, data)); } diff --git a/LFlow.Middleware/Middlewares/LoggingMiddleware.cs b/LFlow.Middleware/Middlewares/LoggingMiddleware.cs index 71dda0c..b8a795c 100644 --- a/LFlow.Middleware/Middlewares/LoggingMiddleware.cs +++ b/LFlow.Middleware/Middlewares/LoggingMiddleware.cs @@ -15,13 +15,34 @@ { var controllerName = context.GetRouteData()?.Values["controller"]?.ToString(); var actionName = context.GetRouteData()?.Values["action"]?.ToString(); - - using (_logger?.BeginScope("LoggingMiddleware")) + var requestId = context.Request.Headers["X-Request-Id"].ToString(); + if (string.IsNullOrEmpty(requestId)) { - _logger?.LogInformation($"Controller: {controllerName} / Action : {actionName}"); - _logger?.LogInformation("Router Data {@routerData}", context.GetRouteData()); - await next(); + requestId = Guid.NewGuid().ToString(); + context.Request.Headers.Append("X-Request-Id", requestId); } + using (_logger?.BeginScope(requestId)) + { + _logger?.LogInformation("Request Id: {requestId}", requestId); + _logger?.LogInformation("Controller: {controllerName} / Action : {actionName}", controllerName, actionName); + // _logger?.LogInformation("Router Data {@routerData}", context.GetRouteData()); + try + { + await next(); + } + catch (Exception ex) + { + _logger?.LogError(ex, "An error occurred while processing the request. Request Id: {requestId}", requestId); + //await context.Response.WriteAsync(JsonConvert.SerializeObject(ApiResult.FailResult("无权限!", 100501))); + // _logger?.LogInformation("Response {@response}", context.Response); + } + } + if (!context.Response.Headers.ContainsKey("X-Request-Id")) + { + + } + // context.Response.Headers.Append("X-Request-Id", requestId); + } } } diff --git a/LFlow.OnlineManegement/Controller/OnlineManagementController.cs b/LFlow.OnlineManegement/Controller/OnlineManagementController.cs index a1e5f9e..353e63a 100644 --- a/LFlow.OnlineManegement/Controller/OnlineManagementController.cs +++ b/LFlow.OnlineManegement/Controller/OnlineManagementController.cs @@ -5,8 +5,20 @@ using LFlow.OnlineManegement.Service; using Microsoft.AspNetCore.Mvc; namespace LFlow.OnlineManegement.Controller; +/// +/// 在线用户管理 +/// +/// public class OnlineManagementController(IOnlineManagementService service) : BaseController { + + + /// + /// 查询所有在线用户 + /// + /// + /// + /// [HttpGet] public PagedApiResult> ListAll(int pageIndex, int pageSize) { @@ -18,7 +30,11 @@ public class OnlineManagementController(IOnlineManagementService service) : Base } return Success(result, dataTotal, pageIndex, pageSize); } - + /// + /// 注册在线用户 + /// + /// + /// [HttpPost] public ApiResult OnlineRegistered(OnlineDto onlineInfo) { diff --git a/LFlow.Permission/Controller/PermissionController.cs b/LFlow.Permission/Controller/PermissionController.cs index dcc2c96..905485a 100644 --- a/LFlow.Permission/Controller/PermissionController.cs +++ b/LFlow.Permission/Controller/PermissionController.cs @@ -10,13 +10,22 @@ namespace LFlow.Permission.Controller /// /// 权限控制 /// - /// - /// public class PermissionController : BaseController { + /// + /// 权限服务 + /// private IPermissionService service; + /// + /// 日志 + /// private ILogger logger; + /// + /// 构造函数 + /// + /// + /// public PermissionController(IPermissionService service, ILogger logger) { @@ -41,11 +50,26 @@ namespace LFlow.Permission.Controller TotalCount = total }; } + /// + /// 添加程序权限 + /// + /// [HttpGet] public async Task>> GetProgPermissions() { var result = await service.GetPermissions(); return Success(result); } + /// + /// Test method to throw an exception + /// + /// ApiResult with an error message + [HttpGet] + public Task> TestException() + { + // var a = 0 / 1; + throw new Exception("Test exception"); + // return Task.FromResult(Success((object)"Success")); + } } } diff --git a/LFlow.Permission/Model/PermissionDto.cs b/LFlow.Permission/Model/PermissionDto.cs index 08c8541..695b77d 100644 --- a/LFlow.Permission/Model/PermissionDto.cs +++ b/LFlow.Permission/Model/PermissionDto.cs @@ -52,5 +52,13 @@ namespace LFlow.Permission.Model get; set; } + /// + /// 是否公开 + /// + public bool IsPublic + { + get; + set; + } } } diff --git a/LFlow.Permission/Model/PermissionModel.cs b/LFlow.Permission/Model/PermissionModel.cs index e972c29..795b5aa 100644 --- a/LFlow.Permission/Model/PermissionModel.cs +++ b/LFlow.Permission/Model/PermissionModel.cs @@ -49,7 +49,15 @@ namespace LFlow.Permission.Model get; set; } - + /// + /// 是否公开 + /// + public bool IsPublic + { + get; + set; + } + } } diff --git a/LFlow.Permission/PermissionMiddleware.cs b/LFlow.Permission/PermissionMiddleware.cs new file mode 100644 index 0000000..bbf4a11 --- /dev/null +++ b/LFlow.Permission/PermissionMiddleware.cs @@ -0,0 +1,50 @@ +using System.Net.Sockets; +using LFlow.Base; +using LFlow.Base.Utils; +using LFlow.Middleware; +using LFlow.Permission.Service; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Routing; +using Newtonsoft.Json; + +namespace LFlow.Permission; + +/// +/// 权限中间件 +/// +public class PermissionMiddleware : ILFlowMiddleware +{ + /// + /// 优先级 + /// + public int Priority => 2; + + /// + /// 执行入口 + /// + /// + /// + /// + /// + public async Task RunAsync(HttpContext context, Func next) + { + var progName = context.GetRouteData()?.Values["controller"]?.ToString(); + var progAction = context.GetRouteData()?.Values["action"]?.ToString(); + if (progName != null) + { + var service = App.GetService(); + var progPermission = service != null ? await service.GetProgPerminssionListAsync(progName) : null; + var currentPermission = progPermission?.FirstOrDefault(p => p.PermissionAction == progAction); + if (currentPermission == null || currentPermission!.IsPublic) + { + await next(); + } + else + { + //TODO 从缓存中根据Token获取用户信息,并判断是否有权限 + await context.Response.WriteAsync(JsonConvert.SerializeObject(ApiResult.FailResult("无权限!", 100501))); + } + } + + } +} \ No newline at end of file diff --git a/LFlow.Permission/PermissionModule.cs b/LFlow.Permission/PermissionModule.cs index 8ae45d0..42bc8fb 100644 --- a/LFlow.Permission/PermissionModule.cs +++ b/LFlow.Permission/PermissionModule.cs @@ -6,19 +6,24 @@ using Serilog; using System.Reflection; namespace LFlow.Permission; - +/// +/// 权限模块 +/// public class PermissionModule : IModule { - + /// + /// 配置模块 + /// + /// public void ConfigureModule(IServiceCollection services) { CodeFirst.AddType(typeof(PermissionModel)); var assembly = Assembly.GetAssembly(typeof(PermissionModule))!; var types = assembly.GetTypes().ToList(); - RegisterModule.RegisterAllService(types, services); - RegisterModule.RegisterAllRepo(types, services); + types.RegisterAllService(services); + types.RegisterAllRepo(services); //RegisterModule.RegisterAllModel(types, services); services.AddControllers().AddApplicationPart(assembly); - Log.Logger?.Information("UserManegementModule ConfigureModule done"); + Log.Logger?.Information("UserManagementModule ConfigureModule done"); } } diff --git a/LFlow.UserManagement/Controller/UserManagementController.cs b/LFlow.UserManagement/Controller/UserManagementController.cs index 50ed9a3..d85c623 100644 --- a/LFlow.UserManagement/Controller/UserManagementController.cs +++ b/LFlow.UserManagement/Controller/UserManagementController.cs @@ -9,6 +9,11 @@ namespace LFlow.UserManagement.Controller { public class UserManagementController(IUserManagementService service, ILogger logger) : BaseController { + /// + /// 登录 + /// + /// + /// [HttpPost] public ApiResult? Login(UserDto user) { @@ -20,6 +25,11 @@ namespace LFlow.UserManagement.Controller } return Success(loginedUser); } + /// + /// 注册 + /// + /// + /// [HttpPost] public ApiResult Register(UserDto user) { diff --git a/LFlow.UserManagement/UserManegementModule.cs b/LFlow.UserManagement/UserManagementModule.cs similarity index 56% rename from LFlow.UserManagement/UserManegementModule.cs rename to LFlow.UserManagement/UserManagementModule.cs index 0b6f6de..1d2106e 100644 --- a/LFlow.UserManagement/UserManegementModule.cs +++ b/LFlow.UserManagement/UserManagementModule.cs @@ -7,18 +7,25 @@ using System.Reflection; namespace LFlow.UserManagement { - public class UserManegementModule : IModule + /// + /// 用户管理模块 + /// + public class UserManagementModule : IModule { + /// + /// 配置模块 + /// + /// public void ConfigureModule(IServiceCollection services) { CodeFirst.AddType(typeof(UserModel)); - var assembly = Assembly.GetAssembly(typeof(UserManegementModule))!; + var assembly = Assembly.GetAssembly(typeof(UserManagementModule))!; var types = assembly.GetTypes().ToList(); - RegisterModule.RegisterAllService(types, services); - RegisterModule.RegisterAllRepo(types, services); + types.RegisterAllService(services); + types.RegisterAllRepo(services); //RegisterModule.RegisterAllModel(types, services); services.AddControllers().AddApplicationPart(assembly); - Log.Logger?.Information("UserManegementModule ConfigureModule done"); + Log.Logger?.Information("UserManagementModule ConfigureModule done"); } } } diff --git a/LFlow.UserManagement/UserMiddleware.cs b/LFlow.UserManagement/UserMiddleware.cs index cb9cb68..c0acb04 100644 --- a/LFlow.UserManagement/UserMiddleware.cs +++ b/LFlow.UserManagement/UserMiddleware.cs @@ -7,20 +7,32 @@ using Serilog; namespace LFlow.UserManagement { + /// + /// 用户管理中间件 + /// + /// public class UserMiddleware(ILogger logger) : ILFlowMiddleware { + /// + /// 优先级 + /// public int Priority => 1; + /// + /// 执行入口 + /// + /// + /// public async Task RunAsync(Microsoft.AspNetCore.Http.HttpContext context, Func next) { // Do something before - var progController = context.GetRouteData()?.Values["controller"]?.ToString(); - var progAction = context.GetRouteData()?.Values["action"]?.ToString(); - if (progAction != "ListAll") + // var progController = context.GetRouteData()?.Values["controller"]?.ToString(); + // var progAction = context.GetRouteData()?.Values["action"]?.ToString(); + // if (progAction != "ListAll") await next(); - else - { - await context.Response.WriteAsync(JsonConvert.SerializeObject(ApiResult.FailResult("无权限!", 100501))); - } + // else + // { + // await context.Response.WriteAsync(JsonConvert.SerializeObject(ApiResult.FailResult("无权限!", 100501))); + // } // Do something after } }