refactor: 抽象操作日志模块
This commit is contained in:
@@ -16,12 +16,6 @@ export default {
|
||||
method: 'post',
|
||||
})
|
||||
},
|
||||
logged() {
|
||||
return myaxios({
|
||||
url: '/Account/logged',
|
||||
method: 'post',
|
||||
})
|
||||
},
|
||||
register(username, password, email, code) {
|
||||
return myaxios({
|
||||
url: `/Account/register?code=${code}`,
|
||||
|
||||
@@ -12,14 +12,16 @@ router.beforeEach((to, from, next) => {
|
||||
next({ path: '/login' });
|
||||
}
|
||||
} else { //如果有user还要向后端请求是否过期
|
||||
store.dispatch("Logged").then(resp => {
|
||||
if (!resp.status) //表示已经过期
|
||||
{
|
||||
store.dispatch("Logout");
|
||||
next({ path: '/login' });
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
})
|
||||
|
||||
next();
|
||||
// store.dispatch("Logged").then(resp => {
|
||||
// if (!resp.status) //表示已经过期
|
||||
// {
|
||||
// store.dispatch("Logout");
|
||||
// next({ path: '/login' });
|
||||
// } else {
|
||||
// next();
|
||||
// }
|
||||
// })
|
||||
}
|
||||
})
|
||||
@@ -63,7 +63,7 @@ const actions = { //动作
|
||||
return new Promise((resolv, reject) => {
|
||||
accountApi.login(form.username.trim(), form.password.trim()).then(resp => {
|
||||
commit('SET_TOKEN', resp.data.token)
|
||||
commit('SET_USER', resp.data.user)
|
||||
// commit('SET_USER', resp.data.user)
|
||||
resolv(resp)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
@@ -82,16 +82,6 @@ const actions = { //动作
|
||||
})
|
||||
})
|
||||
},
|
||||
Logged({ commit }) {
|
||||
return new Promise((resolv, reject) => {
|
||||
accountApi.logged().then(resp => {
|
||||
resolv(resp)
|
||||
}).catch(error => {
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// GetUserInfo({ commit, state }) {
|
||||
// return new Promise((resolv, reject) => {
|
||||
// // getUserInfo(state.token).then(response => {
|
||||
|
||||
@@ -27,7 +27,11 @@ myaxios.interceptors.request.use(function(config) {
|
||||
|
||||
// 响应拦截器
|
||||
myaxios.interceptors.response.use(function(response) {
|
||||
// const resp = response.data
|
||||
const resp = response.data
|
||||
if(resp.code!=200)
|
||||
{
|
||||
alert(`错误代码:${resp.code},原因:${resp.message}`)
|
||||
}
|
||||
store.dispatch("closeLoad");
|
||||
return response;
|
||||
}, function(error) {
|
||||
@@ -35,7 +39,7 @@ myaxios.interceptors.response.use(function(response) {
|
||||
if (resp.code == undefined && resp.msg == undefined) {
|
||||
alert(`错误代码:无,原因:与服务器失去连接`)
|
||||
} else if (resp.code != 200) {
|
||||
alert(`错误代码:${resp.code},原因:${resp.msg}`)
|
||||
alert(`错误代码:${resp.code},原因:${resp.message}`)
|
||||
}
|
||||
store.dispatch("closeLoad");
|
||||
return Promise.reject(error);
|
||||
|
||||
@@ -95,6 +95,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
||||
Version.cs = Version.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Framework.OperLog", "src\module\Yi.Framework.OperLog\Yi.Framework.OperLog.csproj", "{8A604A6B-D1FA-4CFF-BCF5-557519B10FCB}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -245,6 +247,10 @@ Global
|
||||
{FC559052-36EC-4379-B447-298FAD6045F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FC559052-36EC-4379-B447-298FAD6045F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FC559052-36EC-4379-B447-298FAD6045F4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8A604A6B-D1FA-4CFF-BCF5-557519B10FCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8A604A6B-D1FA-4CFF-BCF5-557519B10FCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8A604A6B-D1FA-4CFF-BCF5-557519B10FCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8A604A6B-D1FA-4CFF-BCF5-557519B10FCB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -289,6 +295,7 @@ Global
|
||||
{0C031C7D-6F80-4559-977C-AC001036EC44} = {07C9E949-DB5E-4315-A497-FF73746667D8}
|
||||
{60E54034-792C-4A90-BCDF-4D5FFB45089E} = {EEF5F221-0E32-4A3D-B647-B4B5E7305806}
|
||||
{FC559052-36EC-4379-B447-298FAD6045F4} = {EEF5F221-0E32-4A3D-B647-B4B5E7305806}
|
||||
{8A604A6B-D1FA-4CFF-BCF5-557519B10FCB} = {EEF5F221-0E32-4A3D-B647-B4B5E7305806}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {6C1A3808-0F4F-43FB-A9FE-5F27A3BB2ECF}
|
||||
|
||||
@@ -10,7 +10,14 @@ namespace Yi.Framework.Ddd.Dtos
|
||||
{
|
||||
public class PagedAllResultRequestDto : PagedAndSortedResultRequestDto, IPagedAllResultRequestDto, IPagedAndSortedResultRequestDto, IPageTimeResultRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询开始时间条件
|
||||
/// </summary>
|
||||
public DateTime? StartTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询结束时间条件
|
||||
/// </summary>
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,9 +9,24 @@ namespace Yi.Framework.Ddd.Dtos
|
||||
{
|
||||
public class PagedAndSortedResultRequestDto : IPagedAndSortedResultRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询当前页条件
|
||||
/// </summary>
|
||||
public int PageNum { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 查询分页大小条件
|
||||
/// </summary>
|
||||
public int PageSize { get; set; } = int.MaxValue;
|
||||
|
||||
/// <summary>
|
||||
/// 查询排序字段条件
|
||||
/// </summary>
|
||||
public string? SortBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询排序类别条件
|
||||
/// </summary>
|
||||
public OrderByEnum SortType { get; set; } = OrderByEnum.Desc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,36 @@
|
||||
<name>Yi.Framework.Ddd</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:Yi.Framework.Ddd.Dtos.PagedAllResultRequestDto.StartTime">
|
||||
<summary>
|
||||
查询开始时间条件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Ddd.Dtos.PagedAllResultRequestDto.EndTime">
|
||||
<summary>
|
||||
查询结束时间条件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Ddd.Dtos.PagedAndSortedResultRequestDto.PageNum">
|
||||
<summary>
|
||||
查询当前页条件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Ddd.Dtos.PagedAndSortedResultRequestDto.PageSize">
|
||||
<summary>
|
||||
查询分页大小条件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Ddd.Dtos.PagedAndSortedResultRequestDto.SortBy">
|
||||
<summary>
|
||||
查询排序字段条件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Ddd.Dtos.PagedAndSortedResultRequestDto.SortType">
|
||||
<summary>
|
||||
查询排序类别条件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Ddd.Repositories.IRepository`1._DbQueryable">
|
||||
<summary>
|
||||
注释一下,严格意义这里应该protected,但是我认为 简易程度 与 耦合程度 中是需要进行衡量的
|
||||
|
||||
@@ -10,11 +10,11 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.AspNetCore.Extensions;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.Core.Helper;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.Framework.Model.RABC.Entitys;
|
||||
using Yi.RBAC.Domain.Shared.Logs;
|
||||
|
||||
namespace Yi.RBAC.Domain.Logs
|
||||
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
public class GlobalOperLogAttribute : ActionFilterAttribute
|
||||
{
|
||||
@@ -22,11 +22,11 @@ namespace Yi.RBAC.Domain.Logs
|
||||
private IRepository<OperationLogEntity> _repository;
|
||||
private ICurrentUser _currentUser;
|
||||
//注入一个日志服务
|
||||
public GlobalOperLogAttribute(ILogger<GlobalOperLogAttribute> logger, IRepository<OperationLogEntity> repository,ICurrentUser currentUser)
|
||||
public GlobalOperLogAttribute(ILogger<GlobalOperLogAttribute> logger, IRepository<OperationLogEntity> repository, ICurrentUser currentUser)
|
||||
{
|
||||
_logger = logger;
|
||||
_repository = repository;
|
||||
_currentUser=currentUser;
|
||||
_currentUser = currentUser;
|
||||
}
|
||||
|
||||
public override async void OnResultExecuted(ResultExecutedContext context)
|
||||
@@ -3,15 +3,14 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Logs.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Logs
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
/// <summary>
|
||||
/// OperationLog服务抽象
|
||||
/// </summary>
|
||||
public interface IOperationLogService : ICrudAppService<OperationLogGetListOutputDto, long, OperationLogGetListInputVo >
|
||||
public interface IOperationLogService : ICrudAppService<OperationLogGetListOutputDto, long, OperationLogGetListInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Logs
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
public enum OperEnum
|
||||
{
|
||||
@@ -4,10 +4,10 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Logs
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public class OperLogAttribute : System.Attribute
|
||||
public class OperLogAttribute : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作类型
|
||||
@@ -31,8 +31,8 @@ namespace Yi.RBAC.Domain.Shared.Logs
|
||||
|
||||
public OperLogAttribute(string title, OperEnum operationType)
|
||||
{
|
||||
this.Title = title;
|
||||
this.OperType = operationType;
|
||||
Title = title;
|
||||
OperType = operationType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,14 @@ using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Logs;
|
||||
|
||||
namespace Yi.Framework.Model.RABC.Entitys
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作日志表
|
||||
///</summary>
|
||||
[SugarTable("OperationLog")]
|
||||
public class OperationLogEntity : IEntity<long>, ICreationAuditedObject
|
||||
public class OperationLogEntity : IEntity<long>, ICreationAuditedObject
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
@@ -4,9 +4,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Logs;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Logs.Dtos
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
public class OperationLogGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
@@ -4,9 +4,8 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Logs;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Logs.Dtos
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
public class OperationLogGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
@@ -1,18 +1,15 @@
|
||||
using Yi.RBAC.Application.Contracts.Logs;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Logs.Dtos;
|
||||
using Yi.RBAC.Domain.Logs.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.Framework.Model.RABC.Entitys;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
|
||||
namespace Yi.RBAC.Application.Logs
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
/// <summary>
|
||||
/// OperationLog服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class OperationLogService : CrudAppService<OperationLogEntity, OperationLogGetListOutputDto, long, OperationLogGetListInputVo >,
|
||||
public class OperationLogService : CrudAppService<OperationLogEntity, OperationLogGetListOutputDto, long, OperationLogGetListInputVo>,
|
||||
IOperationLogService, IAutoApiService
|
||||
{
|
||||
public override Task<PagedResultDto<OperationLogGetListOutputDto>> GetListAsync(OperationLogGetListInputVo input)
|
||||
@@ -0,0 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Core\Yi.Framework.Core.csproj" />
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
|
||||
<ProjectReference Include="..\..\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,24 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StartupModules;
|
||||
using Yi.Framework.Core;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
|
||||
namespace Yi.Framework.OperLog
|
||||
{
|
||||
[DependsOn(typeof(YiFrameworkCoreModule))]
|
||||
public class YiFrameworkOperLogModule : IStartupModule
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
services.AddControllers(options => {
|
||||
options.Filters.Add<GlobalOperLogAttribute>();
|
||||
});
|
||||
services.AddSingleton<GlobalOperLogAttribute>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,9 @@ TemplateFactory templateFactory = new();
|
||||
//string modelName = "Dictionary";
|
||||
//string nameSpaces = "Yi.RBAC";
|
||||
//List<string> entityNames = new() { "_", "_" };
|
||||
string modelName = "Logs";
|
||||
string modelName = "Setting";
|
||||
string nameSpaces = "Yi.RBAC";
|
||||
List<string> entityNames = new() { "_" };
|
||||
List<string> entityNames = new() { "File" };
|
||||
|
||||
|
||||
foreach (var entityName in entityNames)
|
||||
|
||||
@@ -120,25 +120,6 @@
|
||||
临时服务,之后用其他模块代替
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.PostLoginAsync">
|
||||
<summary>
|
||||
登录
|
||||
</summary>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.NotImplementedException"></exception>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.PostLogged">
|
||||
<summary>
|
||||
判断是否有登录
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.PostlogOut">
|
||||
<summary>
|
||||
退出登录
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.GetUserInfoByIdAsync(System.Int64)">
|
||||
<summary>
|
||||
获取用户信息
|
||||
|
||||
@@ -10,6 +10,7 @@ using Yi.Framework.Core.Autofac;
|
||||
using Yi.RBAC.Application;
|
||||
using Yi.Framework.AspNetCore;
|
||||
using Yi.Framework.Data.Json;
|
||||
using Yi.Framework.OperLog;
|
||||
|
||||
namespace Yi.BBS.Web
|
||||
{
|
||||
@@ -31,7 +32,8 @@ namespace Yi.BBS.Web
|
||||
{
|
||||
//NETServiceTest所在程序集添加进动态api配置
|
||||
opt.CreateConventional(typeof(YiBBSApplicationModule).Assembly, option => option.RootPath = string.Empty);
|
||||
//opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty);
|
||||
opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty);
|
||||
opt.CreateConventional(typeof(YiFrameworkOperLogModule).Assembly, option => option.RootPath = string.Empty);
|
||||
});
|
||||
|
||||
//添加swagger
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"DbConnOptions": {
|
||||
"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
"DbType": "Sqlite",
|
||||
"EnabledDbSeed": false,
|
||||
"EnabledDbSeed": true,
|
||||
"EnabledReadWrite": false,
|
||||
"EnabledCodeFirst": true,
|
||||
"EntityAssembly": null,
|
||||
|
||||
Binary file not shown.
@@ -120,25 +120,6 @@
|
||||
临时服务,之后用其他模块代替
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.PostLoginAsync">
|
||||
<summary>
|
||||
登录
|
||||
</summary>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.NotImplementedException"></exception>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.PostLogged">
|
||||
<summary>
|
||||
判断是否有登录
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.PostlogOut">
|
||||
<summary>
|
||||
退出登录
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.BBS.Application.GlobalSetting.TempService.GetUserInfoByIdAsync(System.Int64)">
|
||||
<summary>
|
||||
获取用户信息
|
||||
|
||||
@@ -14,43 +14,43 @@ namespace Yi.BBS.Application.GlobalSetting
|
||||
[AppService]
|
||||
public class TempService : ApplicationService, IAutoApiService
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
[Route("/api/account/login")]
|
||||
public Task<LoginDto> PostLoginAsync()
|
||||
{
|
||||
bool loginSucces = true;
|
||||
if (!loginSucces)
|
||||
{
|
||||
throw new UserFriendlyException("登录失败", (int)BbsHttpStatusEnum.LoginFailed, "用户或者密码错误");
|
||||
}
|
||||
var dto = new LoginDto("token");
|
||||
dto.User = new LoginUserInfoDto { Icon = "", Id = 0, Level = 1, UserName = "橙子" };
|
||||
return Task.FromResult(dto);
|
||||
}
|
||||
///// <summary>
|
||||
///// 登录
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
///// <exception cref="NotImplementedException"></exception>
|
||||
//[Route("/api/account/login")]
|
||||
//public Task<LoginDto> PostLoginAsync()
|
||||
//{
|
||||
// bool loginSucces = true;
|
||||
// if (!loginSucces)
|
||||
// {
|
||||
// throw new UserFriendlyException("登录失败", (int)BbsHttpStatusEnum.LoginFailed, "用户或者密码错误");
|
||||
// }
|
||||
// var dto = new LoginDto("token");
|
||||
// dto.User = new LoginUserInfoDto { Icon = "", Id = 0, Level = 1, UserName = "橙子" };
|
||||
// return Task.FromResult(dto);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否有登录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Route("/api/account/logged")]
|
||||
public Task<bool> PostLogged()
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
///// <summary>
|
||||
///// 判断是否有登录
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[Route("/api/account/logged")]
|
||||
//public Task<bool> PostLogged()
|
||||
//{
|
||||
// return Task.FromResult(true);
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 退出登录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Route("/api/account/logout")]
|
||||
public Task PostlogOut()
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
///// <summary>
|
||||
///// 退出登录
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[Route("/api/account/logout")]
|
||||
//public Task PostlogOut()
|
||||
//{
|
||||
// return Task.CompletedTask;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
|
||||
@@ -10,6 +10,7 @@ using Yi.Framework.Core.Autofac;
|
||||
using Yi.RBAC.Application;
|
||||
using Yi.Framework.AspNetCore;
|
||||
using Yi.Framework.Data.Json;
|
||||
using Yi.Framework.OperLog;
|
||||
|
||||
namespace Yi.BBS.Web
|
||||
{
|
||||
@@ -31,7 +32,8 @@ namespace Yi.BBS.Web
|
||||
{
|
||||
//NETServiceTest所在程序集添加进动态api配置
|
||||
opt.CreateConventional(typeof(YiBBSApplicationModule).Assembly, option => option.RootPath = string.Empty);
|
||||
//opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty);
|
||||
opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty);
|
||||
opt.CreateConventional(typeof(YiFrameworkOperLogModule).Assembly, option => option.RootPath = string.Empty);
|
||||
});
|
||||
|
||||
//添加swagger
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"DbConnOptions": {
|
||||
"Url": "DataSource=yi-sqlsugar-dev.db",
|
||||
"DbType": "Sqlite",
|
||||
"EnabledDbSeed": false,
|
||||
"EnabledDbSeed": true,
|
||||
"EnabledReadWrite": false,
|
||||
"EnabledCodeFirst": true,
|
||||
"EntityAssembly": null,
|
||||
|
||||
Binary file not shown.
@@ -94,16 +94,61 @@
|
||||
登录信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Logs.IOperationLogService">
|
||||
<summary>
|
||||
OperationLog服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigCreateInputVo">
|
||||
<summary>
|
||||
Config输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo">
|
||||
<summary>
|
||||
配置查询参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo.ConfigName">
|
||||
<summary>
|
||||
配置名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo.ConfigKey">
|
||||
<summary>
|
||||
配置键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigName">
|
||||
<summary>
|
||||
配置名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigKey">
|
||||
<summary>
|
||||
配置主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigValue">
|
||||
<summary>
|
||||
配置值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigType">
|
||||
<summary>
|
||||
配置类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.OrderNum">
|
||||
<summary>
|
||||
排序字段
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.Remark">
|
||||
<summary>
|
||||
备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.CreationTime">
|
||||
<summary>
|
||||
创建时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Setting.IConfigService">
|
||||
<summary>
|
||||
Config服务抽象
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using Mapster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.User
|
||||
{
|
||||
public class ProfileUpdateInputVo
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum? Sex { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,20 @@ using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Setting.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public class ConfigGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string? ConfigName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ü<EFBFBD>
|
||||
/// </summary>
|
||||
public string? ConfigKey { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,36 @@ namespace Yi.RBAC.Application.Contracts.Setting.Dtos
|
||||
public class ConfigGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string ConfigName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string ConfigKey { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>ֵ
|
||||
/// </summary>
|
||||
public string ConfigValue { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string? ConfigType { get; set; }
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ע
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,6 +171,13 @@
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.UpdateProfileAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.User.ProfileUpdateInputVo)">
|
||||
<summary>
|
||||
更新个人中心
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.UpdateStateAsync(System.Int64,System.Boolean)">
|
||||
<summary>
|
||||
更新状态
|
||||
@@ -179,15 +186,17 @@
|
||||
<param name="state"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Logs.OperationLogService">
|
||||
<summary>
|
||||
OperationLog服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Setting.ConfigService">
|
||||
<summary>
|
||||
Config服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Setting.ConfigService.GetListAsync(Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo)">
|
||||
<summary>
|
||||
多查
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -12,6 +12,8 @@ using SqlSugar;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Auth.JwtBearer.Authorization;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos.User;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
@@ -31,6 +33,9 @@ namespace Yi.RBAC.Application.Identity
|
||||
[Autowired]
|
||||
private IUserRepository _userRepository { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private ICurrentUser _currentUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询用户
|
||||
/// </summary>
|
||||
@@ -135,6 +140,20 @@ namespace Yi.RBAC.Application.Identity
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新个人中心
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<UserGetOutputDto> UpdateProfileAsync(ProfileUpdateInputVo input)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(_currentUser.Id);
|
||||
_mapper.Map(input, entity);
|
||||
await _repository.UpdateAsync(entity);
|
||||
var dto = _mapper.Map<UserGetOutputDto>(entity);
|
||||
return dto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新状态
|
||||
/// </summary>
|
||||
@@ -142,7 +161,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
[Route("/api/user/{id}/{state}")]
|
||||
public async Task<UserGetOutputDto> UpdateStateAsync([FromRoute] long id,[FromRoute] bool state)
|
||||
public async Task<UserGetOutputDto> UpdateStateAsync([FromRoute] long id, [FromRoute] bool state)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
if (entity is null)
|
||||
|
||||
@@ -19,6 +19,11 @@ namespace Yi.RBAC.Application.Setting
|
||||
public class ConfigService : CrudAppService<ConfigEntity, ConfigGetOutputDto, ConfigGetListOutputDto, long, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>,
|
||||
IConfigService, IAutoApiService
|
||||
{
|
||||
/// <summary>
|
||||
/// 多查
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<PagedResultDto<ConfigGetListOutputDto>> GetListAsync(ConfigGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class UserDataSeed : AbstractDataSeed<UserEntity>
|
||||
{
|
||||
public UserDataSeed(IRepository<UserEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<UserEntity> GetSeedData()
|
||||
{
|
||||
var entities=new List<UserEntity>();
|
||||
UserEntity user1 = new UserEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
Name = "大橙子",
|
||||
UserName = "cc",
|
||||
Nick = "橙子",
|
||||
Password = "123456",
|
||||
Email = "454313500@qq.com",
|
||||
Phone = 13800000000,
|
||||
Sex = SexEnum.Male,
|
||||
Address = "深圳",
|
||||
Age = 20,
|
||||
Introduction = "还有谁?",
|
||||
OrderNum = 999,
|
||||
Remark = "描述是什么呢?",
|
||||
State = true
|
||||
};
|
||||
user1.BuildPassword();
|
||||
entities.Add(user1);
|
||||
|
||||
UserEntity user2 = new UserEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
Name = "大测试",
|
||||
UserName = "test",
|
||||
Nick = "测试",
|
||||
Password = "123456",
|
||||
Email = "454313500@qq.com",
|
||||
Phone = 15900000000,
|
||||
Sex = SexEnum.Woman,
|
||||
Address = "深圳",
|
||||
Age = 18,
|
||||
Introduction = "还有我!",
|
||||
OrderNum = 1,
|
||||
Remark = "我没有描述!",
|
||||
State = true
|
||||
|
||||
};
|
||||
user2.BuildPassword();
|
||||
entities.Add(user2);
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -790,55 +790,5 @@
|
||||
描述
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.Framework.Model.RABC.Entitys.OperationLogEntity">
|
||||
<summary>
|
||||
操作日志表
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.Title">
|
||||
<summary>
|
||||
操作模块
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.OperType">
|
||||
<summary>
|
||||
操作类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.RequestMethod">
|
||||
<summary>
|
||||
请求方法
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.OperUser">
|
||||
<summary>
|
||||
操作人员
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.OperIp">
|
||||
<summary>
|
||||
操作Ip
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.OperLocation">
|
||||
<summary>
|
||||
操作地点
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.Method">
|
||||
<summary>
|
||||
操作方法
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.RequestParam">
|
||||
<summary>
|
||||
请求参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.Framework.Model.RABC.Entitys.OperationLogEntity.RequestResult">
|
||||
<summary>
|
||||
请求结果
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Hei.Captcha" Version="0.3.0" />
|
||||
<PackageReference Include="IPTools.China" Version="1.6.0" />
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.EventBus\Yi.Framework.EventBus.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.OperLog\Yi.Framework.OperLog.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.ThumbnailSharp\Yi.Framework.ThumbnailSharp.csproj" />
|
||||
<ProjectReference Include="..\Yi.RBAC.Domain.Shared\Yi.RBAC.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Data;
|
||||
using Yi.Framework.EventBus;
|
||||
using Yi.Framework.OperLog;
|
||||
using Yi.Framework.ThumbnailSharp;
|
||||
using Yi.RBAC.Domain.Logs;
|
||||
using Yi.RBAC.Domain.Shared;
|
||||
@@ -20,7 +21,8 @@ namespace Yi.RBAC.Domain
|
||||
typeof(YiRBACDomainSharedModule),
|
||||
typeof(YiFrameworkDataModule),
|
||||
typeof(YiFrameworkThumbnailSharpModule),
|
||||
typeof(YiFrameworkEventBusModule)
|
||||
typeof(YiFrameworkEventBusModule),
|
||||
typeof(YiFrameworkOperLogModule)
|
||||
)]
|
||||
public class YiRBACDomainModule : IStartupModule
|
||||
{
|
||||
@@ -31,10 +33,7 @@ namespace Yi.RBAC.Domain
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
services.AddHeiCaptcha();
|
||||
services.AddControllers(options => {
|
||||
options.Filters.Add<GlobalOperLogAttribute>();
|
||||
});
|
||||
services.AddSingleton<GlobalOperLogAttribute>();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using Yi.Framework.Core;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Core.Autofac;
|
||||
using Yi.Framework.Data.Json;
|
||||
using Yi.Framework.OperLog;
|
||||
using Yi.RBAC.Application;
|
||||
using Yi.RBAC.Sqlsugar;
|
||||
|
||||
@@ -32,6 +33,7 @@ namespace Yi.RBAC.Web
|
||||
{
|
||||
//NETServiceTest所在程序集添加进动态api配置
|
||||
opt.CreateConventional(typeof(YiRBACApplicationModule).Assembly, option => option.RootPath = string.Empty);
|
||||
opt.CreateConventional(typeof(YiFrameworkOperLogModule).Assembly, option => option.RootPath = string.Empty);
|
||||
});
|
||||
|
||||
//添加swagger
|
||||
|
||||
Binary file not shown.
@@ -69,7 +69,7 @@ export function changeUserStatus(userId, isDel) {
|
||||
// 查询用户个人信息
|
||||
export function getUserProfile() {
|
||||
return request({
|
||||
url: '/account/getUserAllInfo',
|
||||
url: '/account',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
@@ -77,9 +77,9 @@ export function getUserProfile() {
|
||||
// 修改用户个人信息
|
||||
export function updateUserProfile(data) {
|
||||
return request({
|
||||
url: '/user/UpdateProfile',
|
||||
url: `/user/profile`,
|
||||
method: 'put',
|
||||
data: { user: data }
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -74,13 +74,10 @@ service.interceptors.request.use(config => {
|
||||
|
||||
// 响应拦截器
|
||||
service.interceptors.response.use(res => {
|
||||
// // 未设置状态码则默认成功状态
|
||||
// const code = res.data.code || 200;
|
||||
// // 获取错误信息
|
||||
// const msg = errorCode[code] || res.data.message || errorCode['default']
|
||||
|
||||
const code=200;
|
||||
const msg="成功";
|
||||
// 未设置状态码则默认成功状态
|
||||
const code = res.data.code || 200;
|
||||
// 获取错误信息
|
||||
const msg = errorCode[code] || res.data.message || errorCode['default']
|
||||
|
||||
// 二进制数据则直接返回
|
||||
if(res.request.responseType === 'blob' || res.request.responseType === 'arraybuffer'){
|
||||
|
||||
Reference in New Issue
Block a user