using LFlow.Base.Interfaces; using LFlow.Base.Utils; using LFlow.Permission.Model; using LFlow.Permission.Service; using Microsoft.AspNetCore.Mvc; using Serilog; namespace LFlow.Permission.Controller { /// /// 权限控制 /// public class PermissionController : BaseController { /// /// 权限服务 /// private IPermissionService service; /// /// 日志 /// private ILogger logger; /// /// 构造函数 /// /// /// public PermissionController(IPermissionService service, ILogger logger) { this.service = service; this.logger = logger; } /// /// 查询权限 /// /// /// /// [HttpGet] public async Task>> GetAll(int pageSize, int pageIndex) { var total = 0; var list = await service.GetPermissionListAsync(pageIndex, pageSize, ref total); return new PagedApiResult> { Data = list, 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")); } } }