添加项目文件。
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 认证相关组件
|
||||
/// </summary>
|
||||
public sealed class AuthComponent : IServiceComponent
|
||||
{
|
||||
public void Load(IServiceCollection services, ComponentContext componentContext)
|
||||
{
|
||||
// JWT配置
|
||||
services.AddJwt<JwtHandler>(enableGlobalAuthorize: true, jwtBearerConfigure: options =>
|
||||
{
|
||||
//signalr jwt配置
|
||||
options.Events = new JwtBearerEvents
|
||||
{
|
||||
OnMessageReceived = context =>
|
||||
{
|
||||
var accessToken = context.Request.Query["access_token"];
|
||||
|
||||
// If the request is for our hub...
|
||||
var path = context.HttpContext.Request.Path;
|
||||
if (!string.IsNullOrEmpty(accessToken) && path.StartsWithSegments("/hubs"))
|
||||
{
|
||||
// Read the token out of the query string
|
||||
context.Token = accessToken;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
};
|
||||
});
|
||||
// 允许跨域
|
||||
services.AddCorsAccessor();
|
||||
|
||||
//注册自定义授权筛选器
|
||||
services.AddMvcFilter<MyAuthorizationFilter>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using UAParser;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// LoggingMonitor操作日志写入数据库插件
|
||||
/// </summary>
|
||||
public sealed class LoggingMonitorComponent : IServiceComponent
|
||||
{
|
||||
public void Load(IServiceCollection services, ComponentContext componentContext)
|
||||
{
|
||||
//Monitor日志配置
|
||||
services.AddMonitorLogging(options =>
|
||||
{
|
||||
options.JsonIndented = true;// 是否美化 JSON
|
||||
options.GlobalEnabled = true;//全局启用
|
||||
options.ConfigureLogger((logger, logContext, context) =>
|
||||
{
|
||||
var httpContext = context.HttpContext;//获取httpContext
|
||||
//获取头
|
||||
var userAgent = httpContext.Request.Headers["User-Agent"];
|
||||
if (string.IsNullOrEmpty(userAgent)) userAgent = "Other";//如果没有这个头就指定一个
|
||||
//获取客户端信息
|
||||
var client = Parser.GetDefault().Parse(userAgent);
|
||||
// 获取控制器/操作描述器
|
||||
// var controllerActionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;
|
||||
//操作名称默认是控制器名加方法名,自定义操作名称要在action上加Description特性
|
||||
//var option = $"{controllerActionDescriptor.ControllerName}/{controllerActionDescriptor.ActionName}";
|
||||
////获取特性
|
||||
//var monitor = controllerActionDescriptor.MethodInfo.GetCustomAttribute<DescriptionAttribute>();
|
||||
//if (monitor != null)//如果有LoggingMonitor特性
|
||||
// option = monitor.Description;//则将操作名称赋值为控制器上写的title
|
||||
//logContext.Set(LoggingConst.Operation, option);//传操作名称
|
||||
logContext.Set(LoggingConst.CLIENT, client);//客户端信息
|
||||
logContext.Set(LoggingConst.PATH, httpContext.Request.Path.Value);//请求地址
|
||||
logContext.Set(LoggingConst.METHOD, httpContext.Request.Method);//请求方法
|
||||
});
|
||||
});
|
||||
//日志写入数据库配置
|
||||
services.AddDatabaseLogging<DatabaseLoggingWriter>(options =>
|
||||
{
|
||||
options.WriteFilter = logMsg =>
|
||||
{
|
||||
return logMsg.LogName == "System.Logging.LoggingMonitor";//只写入LoggingMonitor日志
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Web设置组件
|
||||
/// 模拟 ConfigureService
|
||||
/// </summary>
|
||||
public sealed class WebSettingsComponent : IServiceComponent
|
||||
{
|
||||
public void Load(IServiceCollection services, ComponentContext componentContext)
|
||||
{
|
||||
//web设置配置转实体
|
||||
services.AddConfigurableOptions<WebSettingsOptions>();
|
||||
|
||||
//禁止在主机启动时通过 App.GetOptions<TOptions> 获取选项,如需获取配置选项理应通过 App.GetConfig<TOptions>("配置节点", true)。
|
||||
var appSettings = App.GetConfig<WebSettingsOptions>("WebSettings", true);
|
||||
//如果是演示环境,加上操作筛选器,禁止操作数据库
|
||||
if (appSettings.EnvPoc)
|
||||
services.AddMvcFilter<MyActionFilter>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Web设置组件
|
||||
/// 模拟 Configure
|
||||
/// </summary>
|
||||
public sealed class WebSettingsApplicationComponent : IApplicationComponent
|
||||
{
|
||||
public void Load(IApplicationBuilder app, IWebHostEnvironment env, ComponentContext componentContext)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 机构管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Application", Tag = "机构管理")]
|
||||
[Route("biz/organization/org")]
|
||||
[RolePermission]
|
||||
public class BizOrgController : IDynamicApiController
|
||||
{
|
||||
private readonly IOrgService _orgService;
|
||||
private readonly IUserService _userService;
|
||||
|
||||
public BizOrgController(IOrgService orgService, IUserService userService)
|
||||
{
|
||||
_orgService = orgService;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
#region Get请求
|
||||
|
||||
/// <summary>
|
||||
/// 获取机构树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
[DisplayName("机构树查询")]
|
||||
public async Task<dynamic> Tree()
|
||||
{
|
||||
return await _orgService.Tree();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 机构分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
[DisplayName("机构分页查询")]
|
||||
public async Task<dynamic> Page([FromQuery] SysOrgPageInput input)
|
||||
{
|
||||
return await _orgService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取机构树选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("orgTreeSelector")]
|
||||
[DisplayName("机构树选择器")]
|
||||
public async Task<dynamic> OrgTreeSelector()
|
||||
{
|
||||
return await _orgService.Tree();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("userSelector")]
|
||||
[DisplayName("人员选择器")]
|
||||
public async Task<dynamic> UserSelector([FromQuery] UserSelectorInput input)
|
||||
{
|
||||
return await _userService.Selector(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 机构详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[DisplayName("机构详情")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _orgService.Detail(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Post请求
|
||||
|
||||
/// <summary>
|
||||
/// 添加机构
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加机构")]
|
||||
public async Task Add([FromBody] SysOrgAddInput input)
|
||||
{
|
||||
await _orgService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改机构
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改机构")]
|
||||
public async Task Edit([FromBody] SysOrgEditInput input)
|
||||
{
|
||||
await _orgService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复制组织
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("copy")]
|
||||
[DisplayName("复制组织")]
|
||||
public async Task Copy(SysOrgCopyInput input)
|
||||
{
|
||||
await _orgService.Copy(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除机构
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除机构")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _orgService.Delete(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 岗位管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Application", Tag = "岗位管理")]
|
||||
[Route("biz/organization/position")]
|
||||
[RolePermission]
|
||||
public class BizPositionController
|
||||
{
|
||||
private readonly IPositionService _positionService;
|
||||
|
||||
public BizPositionController(IPositionService positionService)
|
||||
{
|
||||
_positionService = positionService;
|
||||
}
|
||||
|
||||
#region Get请求
|
||||
|
||||
/// <summary>
|
||||
/// 获取职位树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
[DisplayName("获取职位树")]
|
||||
public async Task<dynamic> Tree([FromQuery] PositionTreeInput input)
|
||||
{
|
||||
return await _positionService.Tree(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 岗位分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
[DisplayName("岗位分页查询")]
|
||||
public async Task<dynamic> Page([FromQuery] PositionPageInput input)
|
||||
{
|
||||
return await _positionService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 岗位详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[DisplayName("岗位详情")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _positionService.Detail(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 岗位选择器
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("selector")]
|
||||
[DisplayName("岗位选择器")]
|
||||
public async Task<dynamic> Selector([FromQuery] PositionSelectorInput input)
|
||||
{
|
||||
return await _positionService.Selector(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Post请求
|
||||
|
||||
/// <summary>
|
||||
/// 添加岗位
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加岗位")]
|
||||
public async Task Add([FromBody] PositionAddInput input)
|
||||
{
|
||||
await _positionService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改岗位
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改岗位")]
|
||||
public async Task Edit([FromBody] PositionEditInput input)
|
||||
{
|
||||
await _positionService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除岗位
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除岗位")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _positionService.Delete(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 业务角色管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "角色管理")]
|
||||
[Route("biz/organization/role")]
|
||||
[RolePermission]
|
||||
public class BizRoleController : IDynamicApiController
|
||||
{
|
||||
private readonly IResourceService _resourceService;
|
||||
private readonly IRoleService _roleService;
|
||||
private readonly ISysUserService _sysUserService;
|
||||
|
||||
public BizRoleController(IResourceService resourceService, IRoleService roleService, ISysUserService sysUserService)
|
||||
{
|
||||
_resourceService = resourceService;
|
||||
_roleService = roleService;
|
||||
_sysUserService = sysUserService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
[DisplayName("角色分页查询")]
|
||||
public async Task<dynamic> Page([FromQuery] RolePageInput input)
|
||||
{
|
||||
return await _roleService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加角色")]
|
||||
public async Task Add([FromBody] RoleAddInput input)
|
||||
{
|
||||
await _roleService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改角色")]
|
||||
public async Task Edit([FromBody] RoleEditInput input)
|
||||
{
|
||||
await _roleService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除角色")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _roleService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色授权资源树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("resourceTreeSelector")]
|
||||
[DisplayName("获取角色授权资源树")]
|
||||
public async Task<dynamic> ResourceTreeSelector()
|
||||
{
|
||||
return await _roleService.ResourceTreeSelector();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色拥有资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownResource")]
|
||||
[DisplayName("获取角色拥有资源")]
|
||||
public async Task<dynamic> OwnResource([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _roleService.OwnResource(input, CateGoryConst.RELATION_SYS_ROLE_HAS_RESOURCE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给角色授权资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantResource")]
|
||||
[DisplayName("角色授权资源")]
|
||||
public async Task GrantResource([FromBody] GrantResourceInput input)
|
||||
{
|
||||
await _roleService.GrantResource(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色下的用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownUser")]
|
||||
[DisplayName("获取角色下的用户")]
|
||||
public async Task<dynamic> OwnUser([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _roleService.OwnUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给角色授权用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantUser")]
|
||||
[DisplayName("角色授权")]
|
||||
public async Task GrantUser([FromBody] GrantUserInput input)
|
||||
{
|
||||
await _roleService.GrantUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
[DisplayName("获取角色树")]
|
||||
public async Task<dynamic> Tree([FromQuery] RoleTreeInput input)
|
||||
{
|
||||
return await _roleService.Tree(input);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[DisplayName("获取角色详情")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _roleService.Detail(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("roleSelector")]
|
||||
[DisplayName("获取角色选择器")]
|
||||
public async Task<dynamic> RoleSelector([FromQuery] RoleSelectorInput input)
|
||||
{
|
||||
return await _roleService.RoleSelector(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 人员管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Application", Tag = "人员管理")]
|
||||
[Route("biz/organization/user")]
|
||||
[RolePermission]
|
||||
public class BizUserController : IDynamicApiController
|
||||
{
|
||||
private readonly IUserService _userService;
|
||||
private readonly IOrgService _orgService;
|
||||
private readonly IPositionService _positionService;
|
||||
|
||||
public BizUserController(IUserService userService, IOrgService orgService, IPositionService positionService)
|
||||
{
|
||||
_userService = userService;
|
||||
_orgService = orgService;
|
||||
_positionService = positionService;
|
||||
}
|
||||
|
||||
#region Get请求
|
||||
|
||||
/// <summary>
|
||||
/// 导入预览
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("preview")]
|
||||
[DisableRequestSizeLimit]
|
||||
[SuppressMonitor]
|
||||
[DisplayName("导入预览")]
|
||||
public async Task<dynamic> Preview([FromForm] ImportPreviewInput input)
|
||||
{
|
||||
return await _userService.Preview(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模板下载
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet(template: "template")]
|
||||
[SuppressMonitor]
|
||||
public async Task<dynamic> Template()
|
||||
{
|
||||
return await _userService.Template();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 人员分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
[DisplayName("人员分页查询")]
|
||||
public async Task<dynamic> Page([FromQuery] UserPageInput input)
|
||||
{
|
||||
return await _userService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("selector")]
|
||||
[DisplayName("人员选择器")]
|
||||
public async Task<dynamic> Selector([FromQuery] UserSelectorInput input)
|
||||
{
|
||||
return await _userService.Selector(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员拥有角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownRole")]
|
||||
[DisplayName("获取人员拥有角色")]
|
||||
public async Task<dynamic> OwnRole([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _userService.OwnRole(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 人员详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[DisplayName("人员详情")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _userService.Detail(input);
|
||||
}
|
||||
|
||||
#endregion Get请求
|
||||
|
||||
#region Post请求
|
||||
|
||||
/// <summary>
|
||||
/// 添加人员
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加人员")]
|
||||
public async Task Add([FromBody] UserAddInput input)
|
||||
{
|
||||
await _userService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改人员
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改人员")]
|
||||
public async Task Edit([FromBody] UserEditInput input)
|
||||
{
|
||||
await _userService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改人员
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edits")]
|
||||
[DisplayName("批量修改人员")]
|
||||
public async Task Edits([FromBody] BatchEditInput input)
|
||||
{
|
||||
await _userService.Edits(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除人员
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除人员")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _userService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 禁用人员
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("disableUser")]
|
||||
[DisplayName("禁用人员")]
|
||||
public async Task DisableUser([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _userService.DisableUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启用人员
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("enableUser")]
|
||||
[DisplayName("启用人员")]
|
||||
public async Task EnableUser([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _userService.EnableUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("resetPassword")]
|
||||
[DisplayName("重置密码")]
|
||||
public async Task ResetPassword([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _userService.ResetPassword(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给人员授权角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantRole")]
|
||||
[DisplayName("授权角色")]
|
||||
public async Task GrantRole([FromBody] UserGrantRoleInput input)
|
||||
{
|
||||
await _userService.GrantRole(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 人员导入
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("import")]
|
||||
[DisplayName("人员导入")]
|
||||
public async Task<dynamic> Import([SuppressMonitor][FromBody] ImportResultInput<BizUserImportInput> input)
|
||||
{
|
||||
return await _userService.Import(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 人员导出
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("export")]
|
||||
[DisplayName("人员导出")]
|
||||
public async Task<dynamic> Export([FromBody] UserPageInput input)
|
||||
{
|
||||
return await _userService.Export(input);
|
||||
}
|
||||
|
||||
#endregion Post请求
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 药材管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Application", Tag = "药材管理")]
|
||||
[Route("biz/weibingju/medicinal")]
|
||||
[RolePermission]
|
||||
public class MedicinalController : IDynamicApiController
|
||||
{
|
||||
private readonly IMedicinalService _medicinalService;
|
||||
|
||||
public MedicinalController(IMedicinalService medicinalService)
|
||||
{
|
||||
_medicinalService = medicinalService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取药材列表
|
||||
/// </summary>
|
||||
[HttpGet("list")]
|
||||
[DisplayName("获取药材列表")]
|
||||
public async Task<dynamic> GetList([FromQuery] string medicinalName, [FromQuery] int pageNum = 1, [FromQuery] int pageSize = 10)
|
||||
{
|
||||
return await _medicinalService.GetMedicinalList(medicinalName, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取药材消耗记录
|
||||
/// </summary>
|
||||
[HttpGet("consumption-records")]
|
||||
[DisplayName("获取药材消耗记录")]
|
||||
public async Task<dynamic> GetConsumptionRecords([FromQuery] long id, [FromQuery] int pageNum = 1, [FromQuery] int pageSize = 10)
|
||||
{
|
||||
return await _medicinalService.GetConsumptionRecords(id, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取药材下拉
|
||||
/// </summary>
|
||||
[HttpGet("getmedicinaldictlist")]
|
||||
[DisplayName("获取药材下拉")]
|
||||
public async Task<dynamic> GetMedicinalDictList()
|
||||
{
|
||||
return await _medicinalService.GetMedicinalDictList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取药材添加记录
|
||||
/// </summary>
|
||||
[HttpGet("addition-records")]
|
||||
[DisplayName("获取药材添加记录")]
|
||||
public async Task<dynamic> GetAdditionRecords(long id, [FromQuery] int pageNum = 1, [FromQuery] int pageSize = 10)
|
||||
{
|
||||
return await _medicinalService.GetAdditionRecords(id, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加药材
|
||||
/// </summary>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加药材")]
|
||||
public async Task<dynamic> AddMedicinal([FromBody] AddMedicinalInput input)
|
||||
{
|
||||
return await _medicinalService.AddMedicinal(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改药材添加记录
|
||||
/// </summary>
|
||||
[HttpPost("addition-records")]
|
||||
[DisplayName("修改药材添加记录")]
|
||||
public async Task<dynamic> UpdateAdditionRecord([FromBody] UpdateMedicinalAddLogInput input)
|
||||
{
|
||||
return await _medicinalService.UpdateAdditionRecord(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除药材添加记录
|
||||
/// </summary>
|
||||
[HttpPost("addition-delete")]
|
||||
[DisplayName("删除药材添加记录")]
|
||||
public async Task<dynamic> DeleteAdditionRecord(DeleteMedicinalLog input)
|
||||
{
|
||||
return await _medicinalService.DeleteAdditionRecord(input.Id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 药材管理
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings("Application", Tag = "处方管理")]
|
||||
[Route("biz/weibingju/prescription")]
|
||||
[RolePermission]
|
||||
public class PrescriptionController : IDynamicApiController
|
||||
{
|
||||
private readonly IPrescriptionService _service;
|
||||
|
||||
public PrescriptionController(IPrescriptionService service)
|
||||
{
|
||||
_service = service;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取处方列表
|
||||
/// </summary>
|
||||
[HttpGet("list")]
|
||||
[DisplayName("获取处方列表")]
|
||||
public async Task<dynamic> GetList([FromQuery] PrescriptionQueryInput input)
|
||||
{
|
||||
return await _service.GetPrescriptionList(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取处方详情
|
||||
/// </summary>
|
||||
[HttpGet("getprescriptiondetile")]
|
||||
[DisplayName("获取处方详情")]
|
||||
public async Task<dynamic> GetDetail(long id)
|
||||
{
|
||||
return await _service.GetPrescriptionDetail(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存处方(新增或编辑)
|
||||
/// </summary>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("保存处方(新增或编辑)")]
|
||||
public async Task<dynamic> SavePrescription([FromBody] SavePrescriptionInput input)
|
||||
{
|
||||
return await _service.SavePrescription(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取人员列表
|
||||
/// </summary>
|
||||
[HttpGet("persons")]
|
||||
[DisplayName("获取人员列表")]
|
||||
public async Task<dynamic> GetPersonList([FromQuery] PersonType? type, [FromQuery] long? employeeId)
|
||||
{
|
||||
return await _service.GetPersonList(type, employeeId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取关系类型
|
||||
/// </summary>
|
||||
[HttpGet("relation-types")]
|
||||
[DisplayName("获取关系类型")]
|
||||
public async Task<dynamic> GetRelationTypes()
|
||||
{
|
||||
return await _service.GetRelationTypes();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// B端登录控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "B端权限校验")]
|
||||
[Route("sys/auth/b")]
|
||||
public class AuthBController : BaseController
|
||||
{
|
||||
private readonly IAuthService _authService;
|
||||
|
||||
public AuthBController(IAuthService authService)
|
||||
{
|
||||
_authService = authService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// B端获取图片验证码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getPicCaptcha")]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> GetPicCaptcha()
|
||||
{
|
||||
return await _authService.GetCaptchaInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// B端获取手机验证码
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getPhoneValidCode")]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> GetPhoneValidCode([FromQuery] GetPhoneValidCodeInput input)
|
||||
{
|
||||
return await _authService.GetPhoneValidCode(input, LoginClientTypeEnum.B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// B端登录
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpPost("login")]
|
||||
[DisplayName(EventSubscriberConst.LOGIN_B)]
|
||||
public async Task<dynamic> Login(LoginInput input)
|
||||
{
|
||||
return await _authService.Login(input, LoginClientTypeEnum.B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// B端手机号登录
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpPost("loginByPhone")]
|
||||
public async Task<dynamic> LoginByPhone(LoginByPhoneInput input)
|
||||
{
|
||||
return await _authService.LoginByPhone(input, LoginClientTypeEnum.B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("logout")]
|
||||
[DisplayName(EventSubscriberConst.LOGIN_OUT_B)]
|
||||
public async Task LoginOut([FromBody] LoginOutInput input)
|
||||
{
|
||||
await _authService.LoginOut(input.Token, LoginClientTypeEnum.B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getLoginUser")]
|
||||
public async Task<dynamic> GetLoginUser()
|
||||
{
|
||||
return await _authService.GetLoginUser();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 会话管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "会话管理")]
|
||||
[Route("sys/auth/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class SessionController : BaseController
|
||||
{
|
||||
private readonly ISessionService _sessionService;
|
||||
|
||||
public SessionController(ISessionService sessionService)
|
||||
{
|
||||
_sessionService = sessionService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// B端会话分页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("b/page")]
|
||||
public async Task<dynamic> PageB([FromQuery] SessionPageInput input)
|
||||
{
|
||||
return await _sessionService.PageB(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C端会话分页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("c/page")]
|
||||
public async Task<dynamic> PageC([FromQuery] SessionPageInput input)
|
||||
{
|
||||
return await _sessionService.PageC(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 会话统计
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("analysis")]
|
||||
public dynamic Analysis()
|
||||
{
|
||||
return _sessionService.Analysis();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 强退B端会话
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
[HttpPost("b/exitSession")]
|
||||
[DisplayName("强退B端会话")]
|
||||
public async Task ExitSessionForB([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _sessionService.ExitSession(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 强退C端会话
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
[HttpPost("c/exitSession")]
|
||||
[DisplayName("强退C端会话")]
|
||||
public async Task ExitSessionForC([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _sessionService.ExitSession(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 强退B端Token
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
[HttpPost("b/ExitToken")]
|
||||
[DisplayName("强退B端Token")]
|
||||
public async Task ExitTokenForB([FromBody] ExitTokenInput input)
|
||||
{
|
||||
await _sessionService.ExitToken(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 强退C端Token
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
[HttpPost("c/ExitToken")]
|
||||
[DisplayName("强退C端Token")]
|
||||
public async Task ExitTokenForC([FromBody] ExitTokenInput input)
|
||||
{
|
||||
await _sessionService.ExitToken(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 基础控制器
|
||||
/// </summary>
|
||||
[Route("sys/[controller]")]
|
||||
public class BaseController : IDynamicApiController
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 批量控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "批量修改")]
|
||||
[Route("/sys/batch")]
|
||||
public class BatchEditController : BaseController
|
||||
{
|
||||
private readonly IBatchEditService _batchEditService;
|
||||
|
||||
public BatchEditController(IBatchEditService updateBatchService)
|
||||
{
|
||||
_batchEditService = updateBatchService;
|
||||
}
|
||||
|
||||
#region Get请求
|
||||
|
||||
/// <summary>
|
||||
/// 批量分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] BatchEditPageInput input)
|
||||
{
|
||||
return await _batchEditService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取表信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tables")]
|
||||
public dynamic Tables()
|
||||
{
|
||||
return _batchEditService.GetTables();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取批量配置信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("configs")]
|
||||
public async Task<dynamic> ConfigList([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _batchEditService.ConfigList(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取批量配置信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("columns")]
|
||||
[IgnoreSuperAdmin]
|
||||
public async Task<dynamic> Columns([FromQuery] string code)
|
||||
{
|
||||
return await _batchEditService.Columns(code);
|
||||
}
|
||||
|
||||
#endregion Get请求
|
||||
|
||||
#region Post请求
|
||||
|
||||
/// <summary>
|
||||
/// 添加批量
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加批量更新")]
|
||||
public async Task Add([FromBody] BatchEditAddInput input)
|
||||
{
|
||||
await _batchEditService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置修改批量
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("config")]
|
||||
[DisplayName("配置批量更新")]
|
||||
public async Task Config([FromBody] List<BatchEditConfigInput> input)
|
||||
{
|
||||
await _batchEditService.Config(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除批量
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除批量更新")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _batchEditService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量更新同步
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("sync")]
|
||||
[DisplayName("批量更新同步")]
|
||||
public async Task Sync([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _batchEditService.SyncColumns(input);
|
||||
}
|
||||
|
||||
#endregion Post请求
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 系统通用控制器,一般是一些公共的接口
|
||||
/// </summary>
|
||||
[Route("sys")]
|
||||
public class CommonController : BaseController
|
||||
{
|
||||
private readonly ISysOrgService _sysOrgService;
|
||||
private readonly IConfigService _configService;
|
||||
|
||||
public CommonController(IConfigService configService, ISysOrgService sysOrgService)
|
||||
{
|
||||
_sysOrgService = sysOrgService;
|
||||
_configService = configService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统基础配置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ico")]
|
||||
[AllowAnonymous]
|
||||
[NonUnify]
|
||||
public async Task<dynamic> Ico()
|
||||
{
|
||||
return await _configService.GetIco();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统基础配置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("sysInfo")]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> SysInfo()
|
||||
{
|
||||
var sysBase = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_BASE);
|
||||
//排除掉一些不需要的配置
|
||||
var configKeys = new List<string>()
|
||||
{
|
||||
SysConfigConst.SYS_ICO,
|
||||
SysConfigConst.SYS_WEB_STATUS,
|
||||
SysConfigConst.SYS_WEB_CLOSE_PROMPT,
|
||||
SysConfigConst.SYS_DEFAULT_WORKBENCH_DATA
|
||||
};
|
||||
sysBase = sysBase.Where(x => !configKeys.Contains(x.ConfigKey)).ToList();
|
||||
return sysBase;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统基础配置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("loginPolicy")]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> LoginPolicy()
|
||||
{
|
||||
var loginPolicy = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_LOGIN_POLICY);//登录策略
|
||||
return loginPolicy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取租户列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tenantList")]
|
||||
[AllowAnonymous]
|
||||
public async Task<dynamic> TenantList()
|
||||
{
|
||||
return await _sysOrgService.GetTenantList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 文件管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "文件管理")]
|
||||
[Route("sys/dev/[controller]")]
|
||||
public class FileController : BaseController
|
||||
{
|
||||
private readonly IFileService _fileService;
|
||||
|
||||
public FileController(IFileService fileService)
|
||||
{
|
||||
_fileService = fileService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 文件查询分页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] FilePageInput input)
|
||||
{
|
||||
return await _fileService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传本地文件
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("uploadLocal")]
|
||||
[DisplayName("上传本地文件")]
|
||||
[Consumes("multipart/form-data")]
|
||||
[DisableRequestSizeLimit]
|
||||
public async Task<long> UploadLocal(IFormFile file)
|
||||
{
|
||||
return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_LOCAL, file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传MINIO文件
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("uploadMinio")]
|
||||
[DisplayName("上传MINIO文件")]
|
||||
[DisableRequestSizeLimit]
|
||||
[Consumes("multipart/form-data")]
|
||||
public async Task<long> UploadMinio(IFormFile file)
|
||||
{
|
||||
return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_MINIO, file);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除文件
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除文件")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _fileService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 下载文件
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("download")]
|
||||
[DisplayName("下载文件")]
|
||||
public async Task<IActionResult> DownLoad([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _fileService.Download(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 站内信控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "站内信")]
|
||||
[Route("sys/dev/[controller]")]
|
||||
public class MessageController : BaseController
|
||||
{
|
||||
private readonly IMessageService _messageService;
|
||||
|
||||
public MessageController(IMessageService messageService)
|
||||
{
|
||||
_messageService = messageService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] MessagePageInput input)
|
||||
{
|
||||
return await _messageService.Page(input);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加站内信
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加站内信")]
|
||||
public async Task Add([FromBody] MessageSendInput input)
|
||||
{
|
||||
await _messageService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑站内信
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("编辑站内信")]
|
||||
public async Task Edit([FromBody] MessageSendUpdateInput input)
|
||||
{
|
||||
await _messageService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 消息详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] MessageDetailInput input)
|
||||
{
|
||||
return await _messageService.Detail(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除站内信
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除站内信")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _messageService.Delete(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成基础控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "代码生成基础")]
|
||||
[Route("sys/curd/gen/basic")]
|
||||
[SuperAdmin]
|
||||
public class GenBasicController : IDynamicApiController
|
||||
{
|
||||
private readonly IGenbasicService _genbasicService;
|
||||
|
||||
public GenBasicController(IGenbasicService genbasicService)
|
||||
{
|
||||
_genbasicService = genbasicService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成基础分页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] BasePageInput input)
|
||||
{
|
||||
return await _genbasicService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有表信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tables")]
|
||||
public dynamic Tables(bool isAll = false)
|
||||
{
|
||||
return _genbasicService.GetTables(isAll);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目所有程序集
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("assemblies")]
|
||||
public dynamic GetAssemblies()
|
||||
{
|
||||
return _genbasicService.GetAssemblies();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加代码生成器
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("添加代码生成")]
|
||||
[HttpPost("add")]
|
||||
public async Task<dynamic> Add([FromBody] GenBasicAddInput input)
|
||||
{
|
||||
return await _genbasicService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑代码生成器
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("编辑代码生成基础")]
|
||||
[HttpPost("edit")]
|
||||
public async Task<dynamic> Edit([FromBody] GenBasicEditInput input)
|
||||
{
|
||||
return await _genbasicService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除代码生成配置
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("删除代码生成基础")]
|
||||
[HttpPost("delete")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _genbasicService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成预览
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("previewGen")]
|
||||
public async Task<dynamic> PreviewGen([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _genbasicService.PreviewGen(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行代码生成(本地)"
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("执行代码生成(本地)")]
|
||||
[HttpPost("execGenPro")]
|
||||
public async Task ExecGenPro([FromBody] ExecGenInput input)
|
||||
{
|
||||
await _genbasicService.ExecGenPro(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行代码生成(压缩包)
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("执行代码生成(压缩包)")]
|
||||
[HttpGet("execGenZip")]
|
||||
public async Task<IActionResult> ExecGenZip([FromQuery] ExecGenInput input)
|
||||
{
|
||||
return await _genbasicService.ExecGenZip(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 代码生成配置控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "代码生成配置")]
|
||||
[Route("sys/curd/gen/config")]
|
||||
[SuperAdmin]
|
||||
public class GenConfigController : IDynamicApiController
|
||||
{
|
||||
private readonly IGenConfigService _genConfigService;
|
||||
|
||||
public GenConfigController(IGenConfigService genConfigService)
|
||||
{
|
||||
_genConfigService = genConfigService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询代码生成详细配置列表
|
||||
/// </summary>
|
||||
/// <param name="basicId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
[QueryParameters]
|
||||
public async Task<dynamic> List(string basicId)
|
||||
{
|
||||
return await _genConfigService.List(basicId.ToLong());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑代码生成详细
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[DisplayName("编辑代码生成详细")]
|
||||
[HttpPost("editBatch")]
|
||||
public async Task EditBatch([FromBody] List<GenConfig> input)
|
||||
{
|
||||
await _genConfigService.EditBatch(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 系统首页控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "系统首页")]
|
||||
[Route("home/index")]
|
||||
[RolePermission]
|
||||
public class IndexController : BaseController
|
||||
{
|
||||
private readonly IVisitLogService _visitLogService;
|
||||
private readonly IOperateLogService _operateLogService;
|
||||
private readonly IIndexService _indexService;
|
||||
|
||||
public IndexController(IVisitLogService visitLogService, IOperateLogService operateLogService, IIndexService indexService)
|
||||
{
|
||||
_visitLogService = visitLogService;
|
||||
_operateLogService = operateLogService;
|
||||
_indexService = indexService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前用户访问日志列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("visLog/list")]
|
||||
[DisplayName("访问日志")]
|
||||
public async Task<dynamic> VisLogList()
|
||||
{
|
||||
return await _visitLogService.Page(new VisitLogPageInput { Account = UserManager.UserAccount });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前用户操作日志列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("opLog/list")]
|
||||
[DisplayName("操作日志")]
|
||||
public async Task<dynamic> OpLogList()
|
||||
{
|
||||
return await _operateLogService.Page(new OperateLogPageInput { Account = UserManager.UserAccount });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前用户站内信列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("message/list")]
|
||||
[DisplayName("站内信列表")]
|
||||
public async Task<dynamic> MessageList()
|
||||
{
|
||||
return new string[] { };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前用户日程列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("schedule/list")]
|
||||
[DisplayName("日程列表")]
|
||||
public async Task<dynamic> ScheduleList([FromQuery] ScheduleListInput input)
|
||||
{
|
||||
return await _indexService.ScheduleList(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加日程
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("schedule/add")]
|
||||
[DisplayName("添加日程")]
|
||||
public async Task AddSchedule([FromBody] ScheduleAddInput input)
|
||||
{
|
||||
await _indexService.AddSchedule(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除日程
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("schedule/deleteSchedule")]
|
||||
[DisplayName("删除日程")]
|
||||
public async Task DeleteSchedule([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _indexService.DeleteSchedule(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 权限按钮控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "权限按钮")]
|
||||
[Route("sys/limit/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class ButtonController : BaseController
|
||||
{
|
||||
private readonly IButtonService _buttonService;
|
||||
|
||||
public ButtonController(IButtonService buttonService)
|
||||
{
|
||||
_buttonService = buttonService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 按钮分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] ButtonPageInput input)
|
||||
{
|
||||
return await _buttonService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加按钮
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加按钮")]
|
||||
public async Task Add([FromBody] ButtonAddInput input)
|
||||
{
|
||||
await _buttonService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改按钮
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改按钮")]
|
||||
public async Task Edit([FromBody] ButtonEditInput input)
|
||||
{
|
||||
await _buttonService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除按钮
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除按钮")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _buttonService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量新增
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("batch")]
|
||||
[DisplayName("新增按钮")]
|
||||
public async Task Batch([FromBody] ButtonAddInput input)
|
||||
{
|
||||
await _buttonService.AddBatch(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取按钮详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _buttonService.Detail(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 菜单管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "菜单管理")]
|
||||
[Route("sys/limit/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class MenuController : BaseController
|
||||
{
|
||||
private readonly IMenuService _menuService;
|
||||
private readonly IResourceService _resourceService;
|
||||
|
||||
public MenuController(IMenuService menuService, IResourceService resourceService)
|
||||
{
|
||||
_menuService = menuService;
|
||||
_resourceService = resourceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模块选择
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("moduleSelector")]
|
||||
public async Task<dynamic> ModuleSelector()
|
||||
{
|
||||
return await _resourceService.GetListByCategory(CateGoryConst.RESOURCE_MODULE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
public async Task<dynamic> Tree([FromQuery] MenuTreeInput input)
|
||||
{
|
||||
return await _menuService.Tree(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单树选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("menuTreeSelector")]
|
||||
public async Task<dynamic> MenuTreeSelector([FromQuery] MenuTreeInput input)
|
||||
{
|
||||
if (input.Module != null)
|
||||
{
|
||||
return await _menuService.Tree(input, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return await _menuService.ShortcutTree();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加菜单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加菜单")]
|
||||
public async Task Add([FromBody] MenuAddInput input)
|
||||
{
|
||||
await _menuService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑菜单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("编辑菜单")]
|
||||
public async Task Edit([FromBody] MenuEditInput input)
|
||||
{
|
||||
await _menuService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取菜单详情
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _menuService.Detail(input);
|
||||
;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除菜单
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除菜单")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _menuService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更改模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("changeModule")]
|
||||
[DisplayName("更改模块")]
|
||||
public async Task ChangeModule([FromBody] MenuChangeModuleInput input)
|
||||
{
|
||||
await _menuService.ChangeModule(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 模块管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "模块管理")]
|
||||
[Route("sys/limit/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class ModuleController : BaseController
|
||||
{
|
||||
private readonly IModuleService _moduleService;
|
||||
|
||||
public ModuleController(IModuleService moduleService)
|
||||
{
|
||||
_moduleService = moduleService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模块分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] ModulePageInput input)
|
||||
{
|
||||
return await _moduleService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加模块")]
|
||||
public async Task Add([FromBody] ModuleAddInput input)
|
||||
{
|
||||
await _moduleService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改模块")]
|
||||
public async Task Edit([FromBody] ModuleEditInput input)
|
||||
{
|
||||
await _moduleService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除模块")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _moduleService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取模块详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _moduleService.Detail(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模块列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public async Task<dynamic> List()
|
||||
{
|
||||
return await _moduleService.List();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 角色管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "角色管理")]
|
||||
[Route("sys/limit/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class RoleController : BaseController
|
||||
{
|
||||
private readonly ISysRoleService _sysRoleService;
|
||||
private readonly IResourceService _resourceService;
|
||||
|
||||
public RoleController(ISysRoleService sysRoleService, IResourceService resourceService)
|
||||
{
|
||||
_sysRoleService = sysRoleService;
|
||||
_resourceService = resourceService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 角色分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] RolePageInput input)
|
||||
{
|
||||
return await _sysRoleService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加角色")]
|
||||
public async Task Add([FromBody] RoleAddInput input)
|
||||
{
|
||||
await _sysRoleService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改角色")]
|
||||
public async Task Edit([FromBody] RoleEditInput input)
|
||||
{
|
||||
await _sysRoleService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除角色")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _sysRoleService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色授权资源树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("resourceTreeSelector")]
|
||||
public async Task<dynamic> ResourceTreeSelector()
|
||||
{
|
||||
return await _resourceService.ResourceTreeSelector();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色拥有资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownResource")]
|
||||
public async Task<dynamic> OwnResource([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysRoleService.OwnResource(input, CateGoryConst.RELATION_SYS_ROLE_HAS_RESOURCE);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给角色授权资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantResource")]
|
||||
[DisplayName("角色授权资源")]
|
||||
public async Task GrantResource([FromBody] GrantResourceInput input)
|
||||
{
|
||||
await _sysRoleService.GrantResource(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取权限授权树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("permissionTreeSelector")]
|
||||
public async Task<dynamic> PermissionTreeSelector([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysRoleService.RolePermissionTreeSelector(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色拥有权限
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownPermission")]
|
||||
public async Task<dynamic> OwnPermission([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysRoleService.OwnPermission(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给角色授权权限
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantPermission")]
|
||||
[DisplayName("角色授权权限")]
|
||||
public async Task GrantPermission([FromBody] GrantPermissionInput input)
|
||||
{
|
||||
await _sysRoleService.GrantPermission(input);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色下的用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownUser")]
|
||||
public async Task<dynamic> OwnUser([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysRoleService.OwnUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给角色授权用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantUser")]
|
||||
[DisplayName("角色授权")]
|
||||
public async Task GrantUser([FromBody] GrantUserInput input)
|
||||
{
|
||||
await _sysRoleService.GrantUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
[DisplayName("获取角色树")]
|
||||
public async Task<dynamic> Tree([FromQuery] RoleTreeInput input)
|
||||
{
|
||||
return await _sysRoleService.Tree(input);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysRoleService.Detail(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取角色选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("roleSelector")]
|
||||
public async Task<dynamic> RoleSelector([FromQuery] RoleSelectorInput input)
|
||||
{
|
||||
return await _sysRoleService.RoleSelector(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 单页管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "单页管理")]
|
||||
[Route("sys/limit/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class SpaController : BaseController
|
||||
{
|
||||
private readonly ISpaService _spaService;
|
||||
|
||||
public SpaController(ISpaService spaService)
|
||||
{
|
||||
_spaService = spaService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 单页分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] SpaPageInput input)
|
||||
{
|
||||
return await _spaService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加单页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加单页")]
|
||||
public async Task Add([FromBody] SpaAddInput input)
|
||||
{
|
||||
await _spaService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改单页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改单页")]
|
||||
public async Task Edit([FromBody] SpaEditInput input)
|
||||
{
|
||||
await _spaService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除单页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除单页")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _spaService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单页详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _spaService.Detail(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "操作日志")]
|
||||
[Route("sys/audit/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class LogOperateController : BaseController
|
||||
{
|
||||
private readonly IOperateLogService _operateLogService;
|
||||
|
||||
public LogOperateController(IOperateLogService operateLogService)
|
||||
{
|
||||
_operateLogService = operateLogService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] OperateLogPageInput input)
|
||||
{
|
||||
return await _operateLogService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志周统计柱状图图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("columnChartData")]
|
||||
public async Task<dynamic> BarChartData()
|
||||
{
|
||||
return await _operateLogService.StatisticsByDay(7);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 操作日志数量总览饼图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("pieChartData")]
|
||||
public async Task<dynamic> PieChartData()
|
||||
{
|
||||
return await _operateLogService.TotalCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空日志
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
public async Task Delete([FromBody] OperateLogDeleteInput input)
|
||||
{
|
||||
await _operateLogService.Delete(input.Category);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 日志详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _operateLogService.Detail(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 访问日志控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "访问日志")]
|
||||
[Route("sys/audit/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class LogVisitController : BaseController
|
||||
{
|
||||
private readonly IVisitLogService _visitLogService;
|
||||
|
||||
public LogVisitController(IVisitLogService visitLogService)
|
||||
{
|
||||
_visitLogService = visitLogService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 访问日志分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] VisitLogPageInput input)
|
||||
{
|
||||
return await _visitLogService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 访问日志周统计折线图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("lineChartData")]
|
||||
public async Task<dynamic> LineChartData()
|
||||
{
|
||||
return await _visitLogService.StatisticsByDay(7);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 访问日志总览饼图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("pieChartData")]
|
||||
public async Task<dynamic> PieChartData()
|
||||
{
|
||||
return await _visitLogService.TotalCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空日志
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
public async Task Delete([FromBody] VisitLogDeleteInput input)
|
||||
{
|
||||
await _visitLogService.Delete(input.Category);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// mqtt服务控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "mqtt服务")]
|
||||
[Route("mqtt")]
|
||||
public class MqttController : IDynamicApiController
|
||||
{
|
||||
private readonly IMqttService _mqttService;
|
||||
|
||||
public MqttController(IMqttService mqttService)
|
||||
{
|
||||
_mqttService = mqttService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取mqtt登录参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getParameter")]
|
||||
public async Task<dynamic> GetParameter()
|
||||
{
|
||||
return await _mqttService.GetWebLoginParameter();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// mqtt认证
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("auth")]
|
||||
[AllowAnonymous]
|
||||
[NonUnify]
|
||||
public async Task<dynamic> Auth([FromBody] MqttAuthInput input)
|
||||
{
|
||||
return await _mqttService.Auth(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 系统配置控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "系统配置")]
|
||||
[Route("sys/ops/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class ConfigController : BaseController
|
||||
{
|
||||
private readonly IConfigService _configService;//系统配置服务
|
||||
|
||||
public ConfigController(IConfigService configService)
|
||||
{
|
||||
_configService = configService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统基础配置
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("sysBaseList")]
|
||||
public async Task<dynamic> SysBaseList()
|
||||
{
|
||||
var sysBase = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_BASE);//系统基础
|
||||
var loginPolicy = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_LOGIN_POLICY);//登录策略
|
||||
sysBase.AddRange(loginPolicy);//合并登录策略
|
||||
return sysBase;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取系统配置列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public async Task<dynamic> List()
|
||||
{
|
||||
return await _configService.GetSysConfigList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置分页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] ConfigPageInput input)
|
||||
{
|
||||
return await _configService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加配置
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加配置")]
|
||||
public async Task Add([FromBody] ConfigAddInput input)
|
||||
{
|
||||
await _configService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改配置
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改配置")]
|
||||
public async Task Edit([FromBody] ConfigEditInput input)
|
||||
{
|
||||
await _configService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除配置
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除配置")]
|
||||
public async Task Delete([FromBody] ConfigDeleteInput input)
|
||||
{
|
||||
await _configService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配置批量更新
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("editBatch")]
|
||||
[DisplayName("修改配置")]
|
||||
public async Task EditBatch([FromBody] List<SysConfig> devConfigs)
|
||||
{
|
||||
await _configService.EditBatch(devConfigs);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 系统字典控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "系统字典")]
|
||||
[Route("sys/ops/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class DictController : BaseController
|
||||
{
|
||||
private readonly IDictService _dictService;
|
||||
|
||||
public DictController(IDictService dictService)
|
||||
{
|
||||
_dictService = dictService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取字典树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
[IgnoreSuperAdmin]
|
||||
public async Task<dynamic> Tree([FromQuery] DictTreeInput input)
|
||||
{
|
||||
return await _dictService.Tree(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字典分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] DictPageInput input)
|
||||
{
|
||||
return await _dictService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加字典
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加字典")]
|
||||
public async Task Add([FromBody] DictAddInput input)
|
||||
{
|
||||
await _dictService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改字典
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改字典")]
|
||||
public async Task Edit([FromBody] DictEditInput input)
|
||||
{
|
||||
await _dictService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除字典
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除字典")]
|
||||
public async Task Delete([FromBody] DictDeleteInput input)
|
||||
{
|
||||
await _dictService.Delete(input);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 组织管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "组织管理")]
|
||||
[Route("sys/organization/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class OrgController : BaseController
|
||||
{
|
||||
private readonly ISysOrgService _sysOrgService;
|
||||
private readonly ISysUserService _sysUserService;
|
||||
|
||||
public OrgController(ISysOrgService sysOrgService, ISysUserService sysUserService)
|
||||
{
|
||||
_sysOrgService = sysOrgService;
|
||||
_sysUserService = sysUserService;
|
||||
}
|
||||
|
||||
#region Get
|
||||
|
||||
/// <summary>
|
||||
/// 获取组织树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
public async Task<dynamic> Tree()
|
||||
{
|
||||
return await _sysOrgService.Tree();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取组织树选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("orgTreeSelector")]
|
||||
public async Task<dynamic> OrgTreeSelector()
|
||||
{
|
||||
return await _sysOrgService.Tree();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 组织分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] SysOrgPageInput input)
|
||||
{
|
||||
return await _sysOrgService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户选择器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("selector")]
|
||||
public async Task<dynamic> UserSelector([FromQuery] UserSelectorInput input)
|
||||
{
|
||||
return await _sysUserService.Selector(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取组织详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysOrgService.Detail(input);
|
||||
}
|
||||
|
||||
#endregion Get
|
||||
|
||||
#region Post
|
||||
|
||||
/// <summary>
|
||||
/// 复制组织
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("copy")]
|
||||
[DisplayName("复制组织")]
|
||||
public async Task Copy([FromBody] SysOrgCopyInput input)
|
||||
{
|
||||
await _sysOrgService.Copy(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加组织
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加组织")]
|
||||
public async Task Add([FromBody] SysOrgAddInput input)
|
||||
{
|
||||
await _sysOrgService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改组织
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改组织")]
|
||||
public async Task Edit([FromBody] SysOrgEditInput input)
|
||||
{
|
||||
await _sysOrgService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除组织
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除组织")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _sysOrgService.Delete(input);
|
||||
}
|
||||
|
||||
#endregion Post
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 职位管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "职位管理")]
|
||||
[Route("sys/organization/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class PositionController : BaseController
|
||||
{
|
||||
private readonly ISysPositionService _sysPositionService;
|
||||
|
||||
public PositionController(ISysPositionService sysPositionService)
|
||||
{
|
||||
_sysPositionService = sysPositionService;
|
||||
}
|
||||
|
||||
#region Get
|
||||
|
||||
/// <summary>
|
||||
/// 职位分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
[DisplayName("职位分页查询")]
|
||||
public async Task<dynamic> Page([FromQuery] PositionPageInput input)
|
||||
{
|
||||
return await _sysPositionService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取职位树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("tree")]
|
||||
[DisplayName("获取职位树")]
|
||||
public async Task<dynamic> Tree([FromQuery] PositionTreeInput input)
|
||||
{
|
||||
return await _sysPositionService.Tree(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 职位选择器
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("selector")]
|
||||
public async Task<dynamic> Selector([FromQuery] PositionSelectorInput input)
|
||||
{
|
||||
return await _sysPositionService.Selector(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取职位详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[DisplayName("获取职位详情")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysPositionService.Detail(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Post
|
||||
|
||||
/// <summary>
|
||||
/// 添加职位
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加职位")]
|
||||
public async Task Add([FromBody] PositionAddInput input)
|
||||
{
|
||||
await _sysPositionService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改职位
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改职位")]
|
||||
public async Task Edit([FromBody] PositionEditInput input)
|
||||
{
|
||||
await _sysPositionService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除职位
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除职位")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _sysPositionService.Delete(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 用户管理控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "用户管理")]
|
||||
[Route("sys/organization/[controller]")]
|
||||
[SuperAdmin]
|
||||
public class UserController : BaseController
|
||||
{
|
||||
private readonly ISysUserService _sysUserService;
|
||||
private readonly ISysOrgService _sysOrgService;
|
||||
private readonly ISysPositionService _sysPositionService;
|
||||
private readonly ISysRoleService _sysRoleService;
|
||||
|
||||
public UserController(ISysUserService sysUserService, ISysOrgService sysOrgService, ISysPositionService sysPositionService,
|
||||
ISysRoleService sysRoleService)
|
||||
{
|
||||
_sysUserService = sysUserService;
|
||||
_sysOrgService = sysOrgService;
|
||||
_sysPositionService = sysPositionService;
|
||||
_sysRoleService = sysRoleService;
|
||||
}
|
||||
|
||||
#region Get请求
|
||||
|
||||
/// <summary>
|
||||
/// 用户分页查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("page")]
|
||||
public async Task<dynamic> Page([FromQuery] UserPageInput input)
|
||||
{
|
||||
return await _sysUserService.Page(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户选择器
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("selector")]
|
||||
public async Task<dynamic> Selector([FromQuery] UserSelectorInput input)
|
||||
{
|
||||
return await _sysUserService.Selector(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户拥有角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownRole")]
|
||||
public async Task<dynamic> OwnRole([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysUserService.OwnRole(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户拥有资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownResource")]
|
||||
public async Task<dynamic> OwnResource([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysUserService.OwnResource(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户拥有权限
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("ownPermission")]
|
||||
public async Task<dynamic> OwnPermission([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysUserService.OwnPermission(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取权限授权树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("permissionTreeSelector")]
|
||||
public async Task<dynamic> PermissionTreeSelector([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysUserService.UserPermissionTreeSelector(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 导入预览
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("preview")]
|
||||
[DisableRequestSizeLimit]
|
||||
[SuppressMonitor]
|
||||
public async Task<dynamic> Preview([FromForm] ImportPreviewInput input)
|
||||
{
|
||||
return await _sysUserService.Preview(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 模板下载
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet(template: "template")]
|
||||
[SuppressMonitor]
|
||||
public async Task<dynamic> Template()
|
||||
{
|
||||
return await _sysUserService.Template();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("detail")]
|
||||
[DisplayName("用户详情")]
|
||||
public async Task<dynamic> Detail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _sysUserService.Detail(input);
|
||||
}
|
||||
|
||||
#endregion Get请求
|
||||
|
||||
#region Post请求
|
||||
|
||||
/// <summary>
|
||||
/// 添加用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("add")]
|
||||
[DisplayName("添加用户")]
|
||||
public async Task Add([FromBody] UserAddInput input)
|
||||
{
|
||||
await _sysUserService.Add(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
[DisplayName("修改用户")]
|
||||
public async Task Edit([FromBody] UserEditInput input)
|
||||
{
|
||||
await _sysUserService.Edit(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量修改用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edits")]
|
||||
[DisplayName("批量修改用户")]
|
||||
public async Task Edits([FromBody] BatchEditInput input)
|
||||
{
|
||||
await _sysUserService.Edits(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
[DisplayName("删除用户")]
|
||||
public async Task Delete([FromBody] BaseIdListInput input)
|
||||
{
|
||||
await _sysUserService.Delete(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 禁用用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("disableUser")]
|
||||
[DisplayName("禁用用户")]
|
||||
public async Task DisableUser([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _sysUserService.DisableUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启用用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("enableUser")]
|
||||
[DisplayName("启用用户")]
|
||||
public async Task EnableUser([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _sysUserService.EnableUser(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("resetPassword")]
|
||||
[DisplayName("重置密码")]
|
||||
public async Task ResetPassword([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _sysUserService.ResetPassword(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给用户授权角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantRole")]
|
||||
[DisplayName("授权角色")]
|
||||
public async Task GrantRole([FromBody] UserGrantRoleInput input)
|
||||
{
|
||||
await _sysUserService.GrantRole(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给用户授权资源
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantResource")]
|
||||
[DisplayName("用户授权资源")]
|
||||
public async Task GrantResource([FromBody] UserGrantResourceInput input)
|
||||
{
|
||||
await _sysUserService.GrantResource(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给用户授权权限
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("grantPermission")]
|
||||
[DisplayName("用户授权权限")]
|
||||
public async Task GrantPermission([FromBody] GrantPermissionInput input)
|
||||
{
|
||||
await _sysUserService.GrantPermission(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户导入
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("import")]
|
||||
[DisplayName("用户导入")]
|
||||
public async Task<dynamic> Import([SuppressMonitor][FromBody] ImportResultInput<SysUserImportInput> input)
|
||||
{
|
||||
return await _sysUserService.Import(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户导出
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("export")]
|
||||
[DisplayName("用户导出")]
|
||||
public async Task<dynamic> Export([FromBody] UserPageInput input)
|
||||
{
|
||||
return await _sysUserService.Export(input);
|
||||
}
|
||||
|
||||
#endregion Post请求
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
[ApiDescriptionSettings(Tag = "文件上传控制器")]
|
||||
public class UploadController : BaseController
|
||||
{
|
||||
private readonly IFileService _fileService;
|
||||
|
||||
public UploadController(IFileService fileService)
|
||||
{
|
||||
_fileService = fileService;
|
||||
}
|
||||
|
||||
/// <summary>1
|
||||
/// 上传图片
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("uploadImg")]
|
||||
[DisplayName("上传图片")]
|
||||
[DisableRequestSizeLimit]
|
||||
[Consumes("multipart/form-data")]
|
||||
public async Task<long> UploadImg(IFormFile file)
|
||||
{
|
||||
//先上传到本地,后面优化
|
||||
return await _fileService.UploadFile(SysDictConst.FILE_ENGINE_LOCAL, file);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 用户个人信息控制器
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = "用户个人信息控制器")]
|
||||
[Route("userCenter")]
|
||||
public class UserCenterController : BaseController
|
||||
{
|
||||
private readonly IUserCenterService _userCenterService;
|
||||
|
||||
public UserCenterController(IUserCenterService userCenterService)
|
||||
{
|
||||
_userCenterService = userCenterService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Get
|
||||
|
||||
/// <summary>
|
||||
/// 获取个人菜单
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("loginMenu")]
|
||||
public async Task<dynamic> LoginMenu([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _userCenterService.GetLoginMenu(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取个人工作台
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("loginWorkbench")]
|
||||
public async Task<dynamic> LoginWorkbench()
|
||||
{
|
||||
return await _userCenterService.GetLoginWorkbench();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取组织架构
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("loginOrgTree")]
|
||||
public async Task<dynamic> LoginOrgTree()
|
||||
{
|
||||
return await _userCenterService.LoginOrgTree();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改密码
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updatePassword")]
|
||||
[DisplayName("修改密码")]
|
||||
public async Task UpdatePassword([FromBody] UpdatePasswordInput input)
|
||||
{
|
||||
await _userCenterService.UpdatePassword(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改头像
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updateAvatar")]
|
||||
[DisplayName("修改头像")]
|
||||
public async Task<dynamic> UpdateAvatar([FromForm] BaseFileInput input)
|
||||
{
|
||||
return await _userCenterService.UpdateAvatar(input);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改默认模块
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
[HttpPost("setDefaultModule")]
|
||||
public async Task SetDefaultModule([FromBody] SetDefaultModuleInput input)
|
||||
{
|
||||
await _userCenterService.SetDefaultModule(input);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 快捷方式菜单树
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("shortcutTree")]
|
||||
public async Task<dynamic> ShortcutTree()
|
||||
{
|
||||
return await _userCenterService.ShortcutTree();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Post
|
||||
|
||||
/// <summary>
|
||||
/// 编辑个人信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updateUserInfo")]
|
||||
[DisplayName("编辑个人信息")]
|
||||
public async Task UpdateUserInfo([FromBody] UpdateInfoInput input)
|
||||
{
|
||||
await _userCenterService.UpdateUserInfo(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新签名
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updateSignature")]
|
||||
[DisplayName("更新签名")]
|
||||
public async Task UpdateSignature([FromBody] UpdateSignatureInput input)
|
||||
{
|
||||
await _userCenterService.UpdateSignature(input);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 编辑工作台
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("updateUserWorkbench")]
|
||||
[DisplayName("编辑工作台")]
|
||||
public async Task UpdateUserWorkbench([FromBody] UpdateWorkbenchInput input)
|
||||
{
|
||||
await _userCenterService.UpdateWorkbench(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 我的消息
|
||||
|
||||
/// <summary>
|
||||
/// 获取登录用户的站内信分页
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("myMessagePage")]
|
||||
public async Task<dynamic> MyMessagePage([FromQuery] MessagePageInput input)
|
||||
{
|
||||
return await _userCenterService.MyMessagePage(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取登录用户站内信详情
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("myMessageDetail")]
|
||||
public async Task<dynamic> MyMessageDetail([FromQuery] BaseIdInput input)
|
||||
{
|
||||
return await _userCenterService.MyMessageDetail(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 未读消息数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("UnReadCount")]
|
||||
public async Task<dynamic> UnReadCount()
|
||||
{
|
||||
return await _userCenterService.UnReadCount();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 最新未读消息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("newUnRead")]
|
||||
public async Task<dynamic> NewUnRead()
|
||||
{
|
||||
return await _userCenterService.NewUnRead();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除我的消息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("deleteMessage")]
|
||||
[DisplayName("删除个人消息")]
|
||||
public async Task DeleteMessage([FromBody] BaseIdInput input)
|
||||
{
|
||||
await _userCenterService.DeleteMyMessage(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置已读
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost("setRead")]
|
||||
public async Task<int> SetRead([FromBody] MessageReadInput input)
|
||||
{
|
||||
input.Id = UserManager.UserId;
|
||||
return await _userCenterService.SetRead(input);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置未读
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("setDelete")]
|
||||
public async Task<int> SetDelete([FromBody] MessageReadInput input)
|
||||
{
|
||||
input.Id = UserManager.UserId;
|
||||
return await _userCenterService.SetDelete(input);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using MoYu.FriendlyException;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 操作筛选器
|
||||
/// </summary>
|
||||
public class MyActionFilter : IAsyncActionFilter
|
||||
{
|
||||
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||
{
|
||||
// 获取控制器、路由信息
|
||||
var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;
|
||||
|
||||
// 获取控制器类型
|
||||
var controllerType = actionDescriptor!.ControllerTypeInfo;
|
||||
|
||||
// 获取请求的方法
|
||||
var method = actionDescriptor!.MethodInfo;
|
||||
|
||||
// 获取 HttpContext 和 HttpRequest 对象
|
||||
var httpContext = context.HttpContext;
|
||||
var httpRequest = httpContext.Request;
|
||||
//拦截白名单
|
||||
var whiteAction = new[] { "loginOut", "auth", "preview" };
|
||||
//只拦截post方法并且不是
|
||||
if (httpRequest.Method == "POST" && !whiteAction.Contains(actionDescriptor.ActionName))
|
||||
{
|
||||
// 是否匿名访问
|
||||
var allowAnonymous = context.Filters.Any(u => u is IAllowAnonymousFilter)
|
||||
|| controllerType.IsDefined(typeof(AllowAnonymousAttribute), true) || method.IsDefined(typeof(AllowAnonymousAttribute), true);
|
||||
if (!allowAnonymous)
|
||||
{
|
||||
//如果不是匿名访问,抛出
|
||||
throw Oops.Bah("演示环境,禁止操作");
|
||||
}
|
||||
}
|
||||
await next();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 自定义授权筛选器
|
||||
/// </summary>
|
||||
public class MyAuthorizationFilter : IAsyncAuthorizationFilter
|
||||
{
|
||||
public async Task OnAuthorizationAsync(AuthorizationFilterContext context)
|
||||
{
|
||||
// 获取控制器信息
|
||||
var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;
|
||||
|
||||
// 获取控制器类型
|
||||
var controllerType = actionDescriptor!.ControllerTypeInfo;
|
||||
|
||||
// 获取 Action 类型
|
||||
var methodType = actionDescriptor.MethodInfo;
|
||||
// 是否匿名访问
|
||||
var allowAnonymous = context.Filters.Any(u => u is IAllowAnonymousFilter) || controllerType.IsDefined(typeof(AllowAnonymousAttribute), true)
|
||||
|| methodType.IsDefined(typeof(AllowAnonymousAttribute), true);
|
||||
|
||||
// 不是匿名才处理权限检查
|
||||
if (!allowAnonymous)
|
||||
{
|
||||
// 获取 HttpContext 和 HttpRequest 对象
|
||||
var httpContext = context.HttpContext;
|
||||
if (httpContext.Response.StatusCode == 401)
|
||||
{
|
||||
// 返回未授权
|
||||
context.Result = new UnauthorizedResult();
|
||||
}
|
||||
}
|
||||
else await Task.CompletedTask;// 否则直接跳过处理
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
global using MoYu;
|
||||
global using MoYu.DynamicApiController;
|
||||
global using MoYu.Logging;
|
||||
global using Microsoft.AspNetCore.Authorization;
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
global using Microsoft.AspNetCore.Hosting;
|
||||
global using Microsoft.AspNetCore.Http;
|
||||
global using Microsoft.AspNetCore.Mvc;
|
||||
global using Microsoft.AspNetCore.Mvc.Authorization;
|
||||
global using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
global using Microsoft.AspNetCore.Mvc.Filters;
|
||||
global using Microsoft.Extensions.DependencyInjection;
|
||||
global using SimpleAdmin.Application;
|
||||
global using SimpleAdmin.Cache;
|
||||
global using SimpleAdmin.Core;
|
||||
global using SimpleAdmin.SqlSugar;
|
||||
global using SimpleAdmin.System;
|
||||
global using System;
|
||||
global using System.Collections.Generic;
|
||||
global using System.ComponentModel;
|
||||
global using System.Linq;
|
||||
global using System.Threading.Tasks;
|
||||
global using Microsoft.AspNetCore.HttpOverrides;
|
||||
global using Microsoft.Extensions.FileProviders;
|
||||
global using Microsoft.Extensions.Hosting;
|
||||
global using Newtonsoft.Json;
|
||||
global using Newtonsoft.Json.Serialization;
|
||||
global using Microsoft.AspNetCore.Builder;
|
||||
global using Microsoft.AspNetCore.Hosting;
|
||||
global using IP2Region.Net.Abstractions;
|
||||
global using IP2Region.Net.XDB;
|
||||
global using NewLife;
|
||||
global using SimpleAdmin.Application.Services.Medicinal;
|
||||
global using SimpleAdmin.Application.Services.Medicinal.Dto;
|
||||
global using SimpleAdmin.Application.Services.Prescription;
|
||||
global using SimpleAdmin.Application.Services.Prescription.Dto;
|
||||
@@ -0,0 +1,142 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using MoYu.Authorization;
|
||||
using MoYu.DataEncryption;
|
||||
using MoYu.Logging.Extensions;
|
||||
using System.Security.Claims;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
public class JwtHandler : AppAuthorizeHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// 重写 Handler 添加自动刷新
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="httpContext"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task HandleAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext)
|
||||
{
|
||||
var expire = App.GetConfig<int>("JWTSettings:ExpiredTime");//获取过期时间(分钟)
|
||||
var currentHttpContext = context.GetCurrentHttpContext();
|
||||
//自动刷新Token
|
||||
if (JWTEncryption.AutoRefreshToken(context, currentHttpContext, expire, expire * 2))
|
||||
{
|
||||
//判断token是否有效
|
||||
if (CheckTokenFromRedis(currentHttpContext, expire))
|
||||
{
|
||||
await AuthorizeHandleAsync(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentHttpContext.Response.StatusCode = 401;//返回401给授权筛选器用
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context.Fail();// 授权失败
|
||||
if (currentHttpContext == null)
|
||||
return;
|
||||
currentHttpContext.SignoutToSwagger();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查token有效性
|
||||
/// </summary>
|
||||
/// <param name="context">DefaultHttpContext</param>
|
||||
/// <param name="expire">token有效期/分钟</param>
|
||||
/// <returns></returns>
|
||||
private bool CheckTokenFromRedis(DefaultHttpContext context, int expire)
|
||||
{
|
||||
var token = JWTEncryption.GetJwtBearerToken(context);//获取当前token
|
||||
var userId = App.User?.FindFirstValue(ClaimConst.USER_ID);//获取用户ID
|
||||
var simpleCacheService = App.GetService<ISimpleCacheService>();//获取redis实例
|
||||
var tokenInfos = simpleCacheService.HashGetOne<List<TokenInfo>>(CacheConst.CACHE_USER_TOKEN, userId);//获取token信息
|
||||
if (tokenInfos == null)//如果还是空
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var tokenInfo = tokenInfos.Where(it => it.Token == token).FirstOrDefault();//获取redis中token值是当前token的对象
|
||||
if (tokenInfo != null)
|
||||
{
|
||||
// 自动刷新token返回新的Token
|
||||
var accessToken = context.Response.Headers["access-token"].ToString();
|
||||
if (!string.IsNullOrEmpty(accessToken))//如果有新的刷新token
|
||||
{
|
||||
"返回新的刷新token".LogDebug<JwtHandler>();
|
||||
tokenInfo.Token = accessToken;//新的token
|
||||
tokenInfo.TokenTimeout = DateTime.Now.AddMinutes(expire);//新的过期时间
|
||||
simpleCacheService.HashAdd(CacheConst.CACHE_USER_TOKEN, userId, tokenInfos);//更新token信息到redis
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 授权判断逻辑,授权通过返回 true,否则返回 false
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="httpContext"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<bool> PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext)
|
||||
{
|
||||
// 这里写您的授权判断逻辑,授权通过返回 true,否则返回 false
|
||||
|
||||
// 此处已经自动验证 Jwt Token的有效性了,无需手动验证
|
||||
return await CheckAuthorizationAsync(httpContext);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查权限
|
||||
/// </summary>
|
||||
/// <param name="httpContext"></param>
|
||||
/// <returns></returns>
|
||||
private static async Task<bool> CheckAuthorizationAsync(DefaultHttpContext httpContext)
|
||||
{
|
||||
//超级管理员都能访问
|
||||
if (UserManager.SuperAdmin) return true;
|
||||
// 获取超级管理员特性
|
||||
var isSuperAdmin = httpContext.GetMetadata<SuperAdminAttribute>();
|
||||
if (isSuperAdmin != null)//如果是超级管理员才能访问的接口
|
||||
{
|
||||
//获取忽略超级管理员特性
|
||||
var ignoreSuperAdmin = httpContext.GetMetadata<IgnoreSuperAdminAttribute>();
|
||||
if (ignoreSuperAdmin == null && !UserManager.SuperAdmin)//如果只能超级管理员访问并且用户不是超级管理员
|
||||
return false;//直接没权限
|
||||
}
|
||||
|
||||
//获取角色授权特性
|
||||
var isRolePermission = httpContext.GetMetadata<RolePermissionAttribute>();
|
||||
if (isRolePermission != null)
|
||||
{
|
||||
//获取忽略角色授权特性
|
||||
var ignoreRolePermission = httpContext.GetMetadata<IgnoreRolePermissionAttribute>();
|
||||
if (ignoreRolePermission == null)
|
||||
{
|
||||
// 路由名称
|
||||
var routeName = httpContext.Request.Path.Value;
|
||||
//获取用户信息
|
||||
var userInfo = await App.GetService<ISysUserService>().GetUserById(UserManager.UserId);
|
||||
if (!userInfo.PermissionCodeList.Contains(routeName))//如果当前路由信息不包含在角色授权路由列表中则认证失败
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using MoYu.DependencyInjection;
|
||||
using MoYu.FriendlyException;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 全局异常处理提供器
|
||||
/// </summary>
|
||||
public class LogExceptionHandler : IGlobalExceptionHandler, ISingleton
|
||||
{
|
||||
private readonly ILogger<LogExceptionHandler> _logger;
|
||||
|
||||
public LogExceptionHandler(ILogger<LogExceptionHandler> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task OnExceptionAsync(ExceptionContext context)
|
||||
{
|
||||
var exception = context.Exception;//获取异常
|
||||
//如果异常类型不是友好异常
|
||||
if (exception.GetType() != typeof(AppFriendlyException))
|
||||
{
|
||||
_logger.LogError(exception, exception.Message);
|
||||
//重新定义异常
|
||||
context.Exception = new AppFriendlyException("系统异常,请联系管理员", ErrorCodeEnum.A0000);
|
||||
}
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using Masuit.Tools;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NewLife.Serialization;
|
||||
using SqlSugar;
|
||||
using System.Globalization;
|
||||
using UAParser;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 数据库写入器
|
||||
/// </summary>
|
||||
public class DatabaseLoggingWriter : IDatabaseLoggingWriter
|
||||
{
|
||||
private readonly ISearcher _searcher;
|
||||
private readonly SqlSugarScope _db;
|
||||
private readonly ILogger<DatabaseLoggingWriter> _logger;
|
||||
|
||||
public DatabaseLoggingWriter(ILogger<DatabaseLoggingWriter> logger, ISearcher searcher)
|
||||
{
|
||||
_db = DbContext.DB;
|
||||
_logger = logger;
|
||||
_searcher = searcher;
|
||||
}
|
||||
|
||||
public async Task WriteAsync(LogMessage logMsg, bool flush)
|
||||
{
|
||||
//获取请求json字符串
|
||||
var jsonString = logMsg.Context.Get("loggingMonitor").ToString();
|
||||
//转成实体
|
||||
var loggingMonitor = jsonString.ToJsonEntity<LoggingMonitorJson>();
|
||||
//日志时间赋值
|
||||
loggingMonitor.LogDateTime = logMsg.LogDateTime;
|
||||
// loggingMonitor.ReturnInformation.Value
|
||||
//验证失败和没有DisplayTitle之类的不记录日志
|
||||
if (loggingMonitor.Validation == null && loggingMonitor.DisplayTitle != null)
|
||||
{
|
||||
//获取操作名称
|
||||
var operation = loggingMonitor.DisplayTitle;
|
||||
var client = (ClientInfo)logMsg.Context.Get(LoggingConst.CLIENT);//获取客户端信息
|
||||
var path = logMsg.Context.Get(LoggingConst.PATH).ToString();//获取操作名称
|
||||
var method = logMsg.Context.Get(LoggingConst.METHOD).ToString();//获取方法
|
||||
//表示访问日志
|
||||
if (operation == EventSubscriberConst.LOGIN_B || operation == EventSubscriberConst.LOGIN_OUT_B)
|
||||
{
|
||||
//如果没有异常信息
|
||||
if (loggingMonitor.Exception == null)
|
||||
{
|
||||
await CreateVisitLog(operation, loggingMonitor, client);//添加到访问日志
|
||||
}
|
||||
else
|
||||
{
|
||||
//添加到异常日志
|
||||
await CreateOperationLog(operation, path, loggingMonitor, client);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//只有定义了Title的POST方法才记录日志
|
||||
if (!operation.Contains("/") && method == "POST")
|
||||
{
|
||||
//添加到操作日志
|
||||
await CreateOperationLog(operation, path, loggingMonitor, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建访问日志
|
||||
/// </summary>
|
||||
/// <param name="operation">访问类型</param>
|
||||
/// <param name="loggingMonitor">loggingMonitor</param>
|
||||
/// <param name="clientInfo">客户端信息</param>
|
||||
private async Task CreateVisitLog(string operation, LoggingMonitorJson loggingMonitor, ClientInfo clientInfo)
|
||||
{
|
||||
string name;//用户姓名
|
||||
string opAccount;//用户账号
|
||||
if (operation == EventSubscriberConst.LOGIN_B)
|
||||
{
|
||||
//如果是登录,用户信息就从返回值里拿
|
||||
var result = loggingMonitor.ReturnInformation.Value.ToJson();//返回值转json
|
||||
var userInfo = result.ToJsonEntity<SimpleAdminResult<SysUser>>();//格式化成user表
|
||||
name = userInfo.Data.Name;//赋值姓名
|
||||
opAccount = userInfo.Data.Account;//赋值账号
|
||||
}
|
||||
else
|
||||
{
|
||||
//如果是登录出,用户信息就从AuthorizationClaims里拿
|
||||
name = loggingMonitor.AuthorizationClaims.Where(it => it.Type == ClaimConst.NAME).Select(it => it.Value).FirstOrDefault();
|
||||
opAccount = loggingMonitor.AuthorizationClaims.Where(it => it.Type == ClaimConst.ACCOUNT).Select(it => it.Value).FirstOrDefault();
|
||||
}
|
||||
//日志表实体
|
||||
var devLogVisit = new SysLogVisit
|
||||
{
|
||||
Name = operation,
|
||||
Category = operation == EventSubscriberConst.LOGIN_B ? CateGoryConst.LOG_LOGIN : CateGoryConst.LOG_LOGOUT,
|
||||
ExeStatus = SysLogConst.SUCCESS,
|
||||
OpAddress = GetLoginAddress(loggingMonitor.RemoteIPv4),
|
||||
OpIp = loggingMonitor.RemoteIPv4,
|
||||
OpBrowser = clientInfo.UA.Family + clientInfo.UA.Major,
|
||||
OpOs = clientInfo.OS.Family + clientInfo.OS.Major,
|
||||
OpTime = loggingMonitor.LogDateTime,
|
||||
OpUser = name,
|
||||
OpAccount = opAccount
|
||||
};
|
||||
await _db.CopyNew().InsertableWithAttr(devLogVisit).IgnoreColumns(true).SplitTable().ExecuteCommandAsync();//入库
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建操作日志
|
||||
/// </summary>
|
||||
/// <param name="operation">操作名称</param>
|
||||
/// <param name="path">请求地址</param>
|
||||
/// <param name="loggingMonitor">loggingMonitor</param>
|
||||
/// <param name="clientInfo">客户端信息</param>
|
||||
/// <returns></returns>
|
||||
private async Task CreateOperationLog(string operation, string path, LoggingMonitorJson loggingMonitor,
|
||||
ClientInfo clientInfo)
|
||||
{
|
||||
//用户名称
|
||||
var name = loggingMonitor.AuthorizationClaims?.Where(it => it.Type == ClaimConst.NAME).Select(it => it.Value).FirstOrDefault();
|
||||
//账号
|
||||
var opAccount = loggingMonitor.AuthorizationClaims?.Where(it => it.Type == ClaimConst.ACCOUNT).Select(it => it.Value).FirstOrDefault();
|
||||
|
||||
//获取参数json字符串,
|
||||
var paramJson = loggingMonitor.Parameters == null || loggingMonitor.Parameters.Count == 0
|
||||
? null
|
||||
: loggingMonitor.Parameters[0].Value.ToJsonString();
|
||||
|
||||
//获取结果json字符串
|
||||
var resultJson = string.Empty;
|
||||
if (loggingMonitor.ReturnInformation != null)//如果有返回值
|
||||
{
|
||||
if (loggingMonitor.ReturnInformation.Value != null)//如果返回值不为空
|
||||
{
|
||||
var time = loggingMonitor.ReturnInformation.Value.Time != null
|
||||
? DateTime.Parse(loggingMonitor.ReturnInformation.Value.Time)
|
||||
: DateTime.Now;//转成时间
|
||||
loggingMonitor.ReturnInformation.Value.Time = time.ToString(CultureInfo.CurrentCulture);//转成字符串
|
||||
resultJson = loggingMonitor.ReturnInformation.Value.ToJsonString();
|
||||
}
|
||||
}
|
||||
|
||||
//操作日志表实体
|
||||
var devLogOperate = new SysLogOperate
|
||||
{
|
||||
Name = operation,
|
||||
Category = CateGoryConst.LOG_OPERATE,
|
||||
ExeStatus = SysLogConst.SUCCESS,
|
||||
OpAddress = GetLoginAddress(loggingMonitor.RemoteIPv4),
|
||||
OpIp = loggingMonitor.RemoteIPv4,
|
||||
OpBrowser = clientInfo.UA.Family + clientInfo.UA.Major,
|
||||
OpOs = clientInfo.OS.Family + clientInfo.OS.Major,
|
||||
OpTime = loggingMonitor.LogDateTime,
|
||||
OpUser = name,
|
||||
OpAccount = opAccount,
|
||||
ReqMethod = loggingMonitor.HttpMethod,
|
||||
ReqUrl = path,
|
||||
ResultJson = resultJson,
|
||||
ClassName = loggingMonitor.DisplayName,
|
||||
MethodName = loggingMonitor.ActionName,
|
||||
ParamJson = paramJson
|
||||
};
|
||||
//如果异常不为空
|
||||
if (loggingMonitor.Exception != null)
|
||||
{
|
||||
devLogOperate.Category = CateGoryConst.LOG_EXCEPTION;//操作类型为异常
|
||||
devLogOperate.ExeStatus = SysLogConst.FAIL;//操作状态为失败
|
||||
devLogOperate.ExeMessage = loggingMonitor.Exception.Type + ":" + loggingMonitor.Exception.Message + "\n"
|
||||
+ loggingMonitor.Exception.StackTrace;
|
||||
}
|
||||
await _db.CopyNew().InsertableWithAttr(devLogOperate).IgnoreColumns(true).SplitTable().ExecuteCommandAsync();//入库
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析IP地址
|
||||
/// </summary>
|
||||
/// <param name="ip"></param>
|
||||
/// <returns></returns>
|
||||
private string GetLoginAddress(string ip)
|
||||
{
|
||||
var loginAddress = "未知";
|
||||
try
|
||||
{
|
||||
var ipInfo = _searcher.Search(ip);//解析ip
|
||||
loginAddress = ipInfo?.Replace("0|", "");//去掉前面的0|
|
||||
}
|
||||
catch (global::System.Exception ex)
|
||||
{
|
||||
_logger.LogError("IP解析错误" + ex, ex);
|
||||
}
|
||||
return loginAddress;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 日志常量
|
||||
/// </summary>
|
||||
public class LoggingConst
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作名称
|
||||
/// </summary>
|
||||
public const string OPERATION = "Operation";
|
||||
|
||||
/// <summary>
|
||||
/// 客户端信息
|
||||
/// </summary>
|
||||
public const string CLIENT = "Client";
|
||||
|
||||
/// <summary>
|
||||
/// 请求地址
|
||||
/// </summary>
|
||||
public const string PATH = "Path";
|
||||
|
||||
/// <summary>
|
||||
/// 请求方法:POST/GET
|
||||
/// </summary>
|
||||
public const string METHOD = "Method";
|
||||
}
|
||||
@@ -0,0 +1,225 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 请求信息格式化
|
||||
/// </summary>
|
||||
public class LoggingMonitorJson
|
||||
{
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作名称
|
||||
/// </summary>
|
||||
public string DisplayTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 控制器名
|
||||
/// </summary>
|
||||
public string ControllerName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 方法名称
|
||||
/// </summary>
|
||||
public string ActionName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类名称
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 服务端
|
||||
/// </summary>
|
||||
public string LocalIPv4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 客户端IPV4地址
|
||||
/// </summary>
|
||||
public string RemoteIPv4 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求方法
|
||||
/// </summary>
|
||||
public string HttpMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求地址
|
||||
/// </summary>
|
||||
public string RequestUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 浏览器标识
|
||||
/// </summary>
|
||||
public string UserAgent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统名称
|
||||
/// </summary>
|
||||
public string OsDescription { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统架构
|
||||
/// </summary>
|
||||
public string OsArchitecture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 环境
|
||||
/// </summary>
|
||||
public string Environment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 认证信息
|
||||
/// </summary>
|
||||
public List<AuthorizationClaims> AuthorizationClaims { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 参数列表
|
||||
/// </summary>
|
||||
public List<Parameters> Parameters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回信息
|
||||
/// </summary>
|
||||
public ReturnInformation ReturnInformation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常信息
|
||||
/// </summary>
|
||||
public Exception Exception { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证错误信息
|
||||
/// </summary>
|
||||
public Validation Validation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日志时间
|
||||
/// </summary>
|
||||
public DateTime LogDateTime { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 认证信息
|
||||
/// </summary>
|
||||
public class AuthorizationClaims
|
||||
{
|
||||
/// <summary>
|
||||
/// 类型
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 请求参数
|
||||
/// </summary>
|
||||
public class Parameters
|
||||
{
|
||||
/// <summary>
|
||||
/// 参数名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
public object Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回信息
|
||||
/// </summary>
|
||||
public class ReturnInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回值
|
||||
/// </summary>
|
||||
public ReturnValue Value { get; set; }
|
||||
|
||||
public class ReturnValue
|
||||
{
|
||||
/// <summary>
|
||||
/// 返回码
|
||||
/// </summary>
|
||||
public int Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消息
|
||||
/// </summary>
|
||||
public string Msg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 额外信息
|
||||
/// </summary>
|
||||
public object Extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内如
|
||||
/// </summary>
|
||||
public object Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间
|
||||
/// </summary>
|
||||
public string Time { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异常信息
|
||||
/// </summary>
|
||||
public class Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// 异常类型
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 异常内容
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 堆栈信息
|
||||
/// </summary>
|
||||
public string StackTrace { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证失败信息
|
||||
/// </summary>
|
||||
public class Validation
|
||||
{
|
||||
///// <summary>
|
||||
///// 错误码
|
||||
///// </summary>
|
||||
//public string ErrorCode { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// 错误码
|
||||
///// </summary>
|
||||
//public string OriginErrorCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误详情
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 网站开启状态 状态中间件
|
||||
/// </summary>
|
||||
public class WebStatusMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public WebStatusMiddleware(RequestDelegate next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public async Task InvokeAsync(HttpContext context)
|
||||
{
|
||||
var path = context.Request.Path.Value;//获取请求路径
|
||||
// 检查请求路径是否以 "/biz" 开头
|
||||
if (path.Length > 1 && !path.Contains('.') && !path.StartsWith("/sys", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// 通过 context.RequestServices 解析
|
||||
var configService = context.RequestServices.GetService<IConfigService>();
|
||||
// 获取网站状态
|
||||
var webStatus = await configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_BASE, SysConfigConst.SYS_WEB_STATUS);
|
||||
// 如果网站状态为禁用,则返回 443 状态码
|
||||
if (webStatus.ConfigValue == CommonStatusConst.DISABLED)
|
||||
{
|
||||
context.Response.StatusCode = 423;
|
||||
return;
|
||||
}
|
||||
}
|
||||
await _next(context);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 中间件拓展类
|
||||
/// </summary>
|
||||
public static class WebStatusMiddlewareExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseWebStatus(this IApplicationBuilder builder)
|
||||
{
|
||||
return builder.UseMiddleware<WebStatusMiddleware>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
using MoYu.ConfigurableOptions;
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// 系统配置选项
|
||||
/// </summary>
|
||||
public class WebSettingsOptions : IConfigurableOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否演示环境
|
||||
/// </summary>
|
||||
public bool EnvPoc { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 是否清除Redis缓存
|
||||
/// </summary>
|
||||
public bool ClearRedis { get; set; } = false;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SimpleAdmin.Application\SimpleAdmin.Application.csproj" />
|
||||
<ProjectReference Include="..\SimpleAdmin.Plugin\SimpleAdmin.Plugin.Mobile\SimpleAdmin.Plugin.Mobile.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="Web.Development.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Web.Production.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,97 @@
|
||||
// Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛
|
||||
//
|
||||
// SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款:
|
||||
// 1.请不要删除和修改根目录下的LICENSE文件。
|
||||
// 2.请不要删除和修改SimpleAdmin源码头部的版权声明。
|
||||
// 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin
|
||||
// 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。
|
||||
// 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为。
|
||||
// 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关。
|
||||
|
||||
namespace SimpleAdmin.Web.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Web启动项配置
|
||||
/// </summary>
|
||||
[AppStartup(99)]
|
||||
public class Startup : AppStartup
|
||||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
//启动LoggingMonitor操作日志写入数据库组件
|
||||
services.AddComponent<LoggingMonitorComponent>();
|
||||
|
||||
//认证组件
|
||||
services.AddComponent<AuthComponent>();
|
||||
//启动Web设置ConfigureServices组件
|
||||
services.AddComponent<WebSettingsComponent>();
|
||||
//gip压缩
|
||||
services.AddComponent<GzipCompressionComponent>();
|
||||
//定时任务
|
||||
//services.AddSchedule();
|
||||
//添加控制器相关
|
||||
services.AddControllers().AddNewtonsoftJson(options => //配置json
|
||||
{
|
||||
options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();// 首字母小写(驼峰样式)
|
||||
options.SerializerSettings.DateFormatString = "yyyy-MM-dd HH:mm:ss";// 时间格式化
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;// 忽略循环引用
|
||||
}).AddInjectWithUnifyResult<SimpleAdminResultProvider>()//配置统一返回模型
|
||||
;
|
||||
|
||||
//Nginx代理的话获取真实IP
|
||||
services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
//新增如下两行
|
||||
options.KnownNetworks.Clear();
|
||||
options.KnownProxies.Clear();
|
||||
});
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
//启动Web设置Configure组件
|
||||
app.UseComponent<WebSettingsApplicationComponent>(env);
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
//启用gzip压缩
|
||||
app.UseResponseCompression();
|
||||
}
|
||||
// 启用HTTPS
|
||||
app.UseHttpsRedirection();
|
||||
|
||||
// 添加状态码拦截中间件
|
||||
app.UseUnifyResultStatusCodes();
|
||||
|
||||
app.UseStaticFiles();//静态文件访问配置
|
||||
|
||||
//静态文件访问配置,暂时不开启
|
||||
// app.UseStaticFiles(new StaticFileOptions
|
||||
// {
|
||||
// ServeUnknownFileTypes = true,
|
||||
// FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")),//wwwroot相当于真实目录
|
||||
// OnPrepareResponse = c =>
|
||||
// {
|
||||
// c.Context.Response.Headers.Add("Access-Control-Allow-Origin", "*");
|
||||
// c.Context.Response.Headers.Append("Cache-Control", "public, max-age=604800");
|
||||
// },
|
||||
// RequestPath = new PathString("/files")//src相当于别名,为了安全
|
||||
// });
|
||||
app.UseRouting();//路由配置
|
||||
app.UseCorsAccessor();//跨域配置
|
||||
app.UseWebStatus();//网站开启状态
|
||||
app.UseAuthentication();//认证
|
||||
app.UseAuthorization();//授权
|
||||
app.UseInject(string.Empty);
|
||||
app.UseForwardedHeaders();//Nginx代理的话获取真实IP
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
//web设置
|
||||
"WebSettings": {
|
||||
"EnvPoc": false, //是否演示环境
|
||||
},
|
||||
//jwt设置
|
||||
"JWTSettings": {
|
||||
"ValidateIssuerSigningKey": true, // 是否验证密钥,bool 类型,默认true
|
||||
"IssuerSigningKey": "3c1cbc3f546eda35168c3aa3cb91780fbe703f0996c1d133ea96dc85c70bbc0a", // 密钥,string 类型,必须是复杂密钥,长度大于16
|
||||
"ValidateIssuer": true, // 是否验证签发方,bool 类型,默认true
|
||||
"ValidIssuer": "SimpleAdmin", // 签发方,string 类型
|
||||
"ValidateAudience": true, // 是否验证签收方,bool 类型,默认true
|
||||
"ValidAudience": "SimpleAdmin", // 签收方,string 类型
|
||||
"ValidateLifetime": true, // 是否验证过期时间,bool 类型,默认true,建议true
|
||||
"ExpiredTime": 50000, // 过期时间,long 类型,单位分钟,默认20分钟
|
||||
"ClockSkew": 10, // 过期时间容错值,long 类型,单位秒,默认5秒
|
||||
"Algorithm": "HS256" // 加密算法,string 类型,默认 HS256
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
//web设置
|
||||
"WebSettings": {
|
||||
"EnvPoc": false, //是否演示环境
|
||||
},
|
||||
//jwt设置
|
||||
"JWTSettings": {
|
||||
"ValidateIssuerSigningKey": true, // 是否验证密钥,bool 类型,默认true
|
||||
"IssuerSigningKey": "3c1cbc3f546eda35168c3aa3cb91780fbe703f0996c1d133ea96dc85c70bbc0a", // 密钥,string 类型,必须是复杂密钥,长度大于16
|
||||
"ValidateIssuer": true, // 是否验证签发方,bool 类型,默认true
|
||||
"ValidIssuer": "SimpleAdmin", // 签发方,string 类型
|
||||
"ValidateAudience": true, // 是否验证签收方,bool 类型,默认true
|
||||
"ValidAudience": "SimpleAdmin", // 签收方,string 类型
|
||||
"ValidateLifetime": true, // 是否验证过期时间,bool 类型,默认true,建议true
|
||||
"ExpiredTime": 50000, // 过期时间,long 类型,单位分钟,默认20分钟
|
||||
"ClockSkew": 10, // 过期时间容错值,long 类型,单位秒,默认5秒
|
||||
"Algorithm": "HS256" // 加密算法,string 类型,默认 HS256
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user