feat:让程序能够跑起来

This commit is contained in:
橙子
2023-04-15 12:19:02 +08:00
parent b9dad93c9d
commit 543c13d94b
15 changed files with 500 additions and 40 deletions

View File

@@ -1,4 +1,5 @@
using Furion;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
@@ -76,7 +77,7 @@ where TEntityDto : IEntityDto<TKey>
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public virtual async Task<PagedResultDto<TGetListOutputDto>> GetListAsync(TGetListInput input)
public virtual async Task<PagedResultDto<TGetListOutputDto>> GetListAsync([FromQuery]TGetListInput input)
{
var totalCount = -1;

View File

@@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Yi.Framework.Infrastructure.AspNetCore;
using Yi.Framework.Infrastructure.Sqlsugar;
using Yi.Framework.Module.ImageSharp.HeiCaptcha;
namespace Yi.Framework.Module;
@@ -17,6 +18,8 @@ public class Startup : AppStartup
services.Configure<DbConnOptions>(App.Configuration.GetSection("DbConnOptions"));
services.AddDbSqlsugarContextServer();
services.AddHeiCaptcha();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

View File

@@ -5,6 +5,13 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<None Remove="ImageSharp\HeiCaptcha\fonts\Candara.ttf" />
<None Remove="ImageSharp\HeiCaptcha\fonts\impact.ttf" />
<None Remove="ImageSharp\HeiCaptcha\fonts\monbaiti.ttf" />
<None Remove="ImageSharp\HeiCaptcha\fonts\STCAIYUN.ttf" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="2.0.23" />
@@ -15,5 +22,12 @@
<ItemGroup>
<ProjectReference Include="..\Yi.Framework.Infrastructure\Yi.Framework.Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ImageSharp\HeiCaptcha\fonts\Candara.ttf" />
<EmbeddedResource Include="ImageSharp\HeiCaptcha\fonts\impact.ttf" />
<EmbeddedResource Include="ImageSharp\HeiCaptcha\fonts\monbaiti.ttf" />
<EmbeddedResource Include="ImageSharp\HeiCaptcha\fonts\STCAIYUN.ttf" />
</ItemGroup>
</Project>

View File

@@ -10,7 +10,5 @@ namespace Yi.Furion.Rbac.Application.System.Dtos.Dept
public string DeptCode { get; set; }
public string Leader { get; set; }
public DateTime? StartTime { get; set; }
public DateTime? EndTime { get; set; }
}
}

View File

@@ -9,16 +9,17 @@ using Yi.Furion.Rbac.Core.Etos;
namespace Yi.Furion.Rbac.Application.System.Event
{
public class LoginEventHandler : IEventSubscriber, ISingleton
public class LoginEventHandler : IEventSubscriber,ISingleton
{
private readonly IRepository<LoginLogEntity> _loginLogRepository;
private readonly HttpContext _httpContext;
private readonly IHttpContextAccessor _httpContextAccessor;
private HttpContext _httpContext=> _httpContextAccessor.HttpContext;
public LoginEventHandler(IRepository<LoginLogEntity> loginLogRepository, IHttpContextAccessor httpContextAccessor)
{
_loginLogRepository = loginLogRepository;
_httpContext = httpContextAccessor.HttpContext;
_httpContextAccessor = httpContextAccessor;
}
[EventSubscribe(nameof(LoginEventSource))]
//[EventSubscribe(nameof(LoginEventSource))]
public Task HandlerAsync(EventHandlerExecutingContext context)
{
var eventData=(LoginEventArgs)context.Source.Payload;

View File

@@ -27,7 +27,6 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
(_userRepository, _currentUser, _accountManager, _menuRepository, _smsAliyunManager, _smsAliyunManagerOptions, _securityCode, _memoryCache, _eventPublisher) =
(userRepository, currentUser, accountManager, menuRepository, smsAliyunManager, smsAliyunManagerOptions, securityCode, memoryCache, eventPublisher);
private JwtTokenManager _jwtTokenManager { get; set; }
private IUserRepository _userRepository { get; set; }
@@ -140,8 +139,8 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
#pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
//创建token
var token = _jwtTokenManager.CreateToken(_accountManager.UserInfoToClaim(userInfo));
return new { Token = token };
var accessToken = JWTEncryption.Encrypt(_accountManager.UserInfoToClaim(userInfo));
return new { Token = accessToken };
}
/// <summary>

View File

@@ -14,13 +14,12 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
public class RoleService : CrudAppService<RoleEntity, RoleGetOutputDto, RoleGetListOutputDto, long, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>,
IRoleService, ITransient, IDynamicApiController
{
public RoleService(RoleManager roleManager, IUnitOfWorkManager unitOfWorkManager) =>
(_roleManager, _unitOfWorkManager) =
(roleManager, unitOfWorkManager);
public RoleService(RoleManager roleManager) =>
(_roleManager) =
(roleManager);
private RoleManager _roleManager { get; set; }
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
public override async Task<PagedResultDto<RoleGetListOutputDto>> GetListAsync(RoleGetListInputVo input)
@@ -44,14 +43,14 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
public override async Task<RoleGetOutputDto> CreateAsync(RoleCreateInputVo input)
{
RoleGetOutputDto outputDto;
using (var uow = _unitOfWorkManager.CreateContext())
{
//using (var uow = _unitOfWorkManager.CreateContext())
//{
var entity = await MapToEntityAsync(input);
await _repository.InsertAsync(entity);
outputDto = await MapToGetOutputDtoAsync(entity);
await _roleManager.GiveRoleSetMenuAsync(new List<long> { entity.Id }, input.MenuIds);
uow.Commit();
}
// uow.Commit();
//}
return outputDto;
}
@@ -65,8 +64,8 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
public override async Task<RoleGetOutputDto> UpdateAsync(long id, RoleUpdateInputVo input)
{
var dto = new RoleGetOutputDto();
using (var uow = _unitOfWorkManager.CreateContext())
{
//using (var uow = _unitOfWorkManager.CreateContext())
//{
var entity = await _repository.GetByIdAsync(id);
await MapToEntityAsync(input, entity);
await _repository.UpdateAsync(entity);
@@ -74,8 +73,8 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
await _roleManager.GiveRoleSetMenuAsync(new List<long> { id }, input.MenuIds);
dto = await MapToGetOutputDtoAsync(entity);
uow.Commit();
}
// uow.Commit();
//}
return dto;
}

View File

@@ -21,15 +21,11 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
{
public UserService(UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser, IUnitOfWorkManager unitOfWorkManager) =>
(_userManager, _userRepository, _currentUser, _unitOfWorkManager) =
(userManager, userRepository, currentUser, unitOfWorkManager);
public UserService(UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser) =>
(_userManager, _userRepository, _currentUser) =
(userManager, userRepository, currentUser);
private UserManager _userManager { get; set; }
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
private IUserRepository _userRepository { get; set; }
@@ -91,16 +87,16 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
entities.BuildPassword();
using (var uow = _unitOfWorkManager.CreateContext())
{
//using (var uow = _unitOfWorkManager.CreateContext())
//{
var returnEntity = await _repository.InsertReturnEntityAsync(entities);
await _userManager.GiveUserSetRoleAsync(new List<long> { returnEntity.Id }, input.RoleIds);
await _userManager.GiveUserSetPostAsync(new List<long> { returnEntity.Id }, input.PostIds);
uow.Commit();
//uow.Commit();
var result = await MapToGetOutputDtoAsync(returnEntity);
return result;
}
//}
}
/// <summary>
/// 单查
@@ -136,13 +132,13 @@ namespace Yi.Furion.Rbac.Application.System.Services.Impl
entity.BuildPassword();
}
await MapToEntityAsync(input, entity);
using (var uow = _unitOfWorkManager.CreateContext())
{
//using (var uow = _unitOfWorkManager.CreateContext())
//{
var res1 = await _repository.UpdateAsync(entity);
await _userManager.GiveUserSetRoleAsync(new List<long> { id }, input.RoleIds);
await _userManager.GiveUserSetPostAsync(new List<long> { id }, input.PostIds);
uow.Commit();
}
// uow.Commit();
//}
return await MapToGetOutputDtoAsync(entity);
}

View File

@@ -4,5 +4,361 @@
<name>Yi.Furion.Rbac.Application</name>
</assembly>
<members>
<member name="T:Yi.Furion.Rbac.Application.System.Domain.AccountManager">
<summary>
用户领域服务
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.AccountManager.LoginValidationAsync(System.String,System.String,System.Action{Yi.Furion.Rbac.Core.Entities.UserEntity})">
<summary>
登录效验
</summary>
<param name="userName"></param>
<param name="password"></param>
<param name="userAction"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.AccountManager.ExistAsync(System.String,System.Action{Yi.Furion.Rbac.Core.Entities.UserEntity})">
<summary>
判断账户合法存在
</summary>
<param name="userName"></param>
<param name="userAction"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.AccountManager.UserInfoToClaim(Yi.Furion.Rbac.Core.Dtos.UserRoleMenuDto)">
<summary>
令牌转换
</summary>
<param name="dto"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.AccountManager.UpdatePasswordAsync(System.Int64,System.String,System.String)">
<summary>
更新密码
</summary>
<param name="userId"></param>
<param name="newPassword"></param>
<param name="oldPassword"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.AccountManager.RestPasswordAsync(System.Int64,System.String)">
<summary>
重置密码
</summary>
<param name="userId"></param>
<param name="password"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.RoleManager.GiveRoleSetMenuAsync(System.Collections.Generic.List{System.Int64},System.Collections.Generic.List{System.Int64})">
<summary>
给角色设置菜单
</summary>
<param name="roleIds"></param>
<param name="menuIds"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.UserManager.GiveUserSetRoleAsync(System.Collections.Generic.List{System.Int64},System.Collections.Generic.List{System.Int64})">
<summary>
给用户设置角色
</summary>
<param name="userIds"></param>
<param name="roleIds"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Domain.UserManager.GiveUserSetPostAsync(System.Collections.Generic.List{System.Int64},System.Collections.Generic.List{System.Int64})">
<summary>
给用户设置岗位
</summary>
<param name="userIds"></param>
<param name="postIds"></param>
<returns></returns>
</member>
<member name="P:Yi.Furion.Rbac.Application.System.Dtos.Account.RegisterDto.UserName">
<summary>
账号
</summary>
</member>
<member name="P:Yi.Furion.Rbac.Application.System.Dtos.Account.RegisterDto.Password">
<summary>
密码
</summary>
</member>
<member name="P:Yi.Furion.Rbac.Application.System.Dtos.Account.RegisterDto.Uuid">
<summary>
唯一标识码
</summary>
</member>
<member name="P:Yi.Furion.Rbac.Application.System.Dtos.Account.RegisterDto.Phone">
<summary>
电话
</summary>
</member>
<member name="P:Yi.Furion.Rbac.Application.System.Dtos.Account.RegisterDto.Code">
<summary>
验证码
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Dtos.Dept.DeptCreateInputVo">
<summary>
Dept输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Dtos.Menu.MenuCreateInputVo">
<summary>
Menu输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Dtos.Post.PostCreateInputVo">
<summary>
Post输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Dtos.Role.RoleCreateInputVo">
<summary>
Role输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Dtos.User.UserCreateInputVo">
<summary>
User输入创建对象
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Event.LoginEventHandler.GetClientInfo(Microsoft.AspNetCore.Http.HttpContext)">
<summary>
获取客户端信息
</summary>
<param name="context"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Event.LoginEventHandler.GetLoginLogInfo(Microsoft.AspNetCore.Http.HttpContext)">
<summary>
记录用户登陆信息
</summary>
<param name="context"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.IDeptService">
<summary>
Dept服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.IMenuService">
<summary>
Menu服务抽象
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.ValidationImageCaptcha(Yi.Furion.Rbac.Application.System.Dtos.Account.LoginInputVo)">
<summary>
效验图片登录验证码,无需和账号绑定
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.ValidationPhoneCaptcha(Yi.Furion.Rbac.Application.System.Dtos.Account.RegisterDto)">
<summary>
效验电话验证码,需要与电话号码绑定
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.PostLoginAsync(Yi.Furion.Rbac.Application.System.Dtos.Account.LoginInputVo)">
<summary>
登录
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.GetCaptchaImage">
<summary>
生成验证码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.ValidationPhone(System.String)">
<summary>
验证电话号码
</summary>
<param name="str_handset"></param>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.PostCaptchaPhone(Yi.Furion.Rbac.Application.System.Dtos.Account.PhoneCaptchaImageDto)">
<summary>
注册 手机验证码
</summary>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.PostRegisterAsync(Yi.Furion.Rbac.Application.System.Dtos.Account.RegisterDto)">
<summary>
注册,需要验证码通过
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.Get">
<summary>
查询已登录的账户信息
</summary>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.AuthException"></exception>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.GetVue3Router">
<summary>
获取当前登录用户的前端路由
</summary>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.PostLogout">
<summary>
退出登录
</summary>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.UpdatePasswordAsync(Yi.Furion.Rbac.Application.System.Dtos.Account.UpdatePasswordDto)">
<summary>
更新密码
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.RestPasswordAsync(System.Int64,Yi.Furion.Rbac.Application.System.Dtos.Account.RestPasswordDto)">
<summary>
重置密码
</summary>
<param name="userId"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.AccountService.UpdateIconAsync(Yi.Furion.Rbac.Application.System.Dtos.Account.UpdateIconDto)">
<summary>
更新头像
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.Impl.DeptService">
<summary>
Dept服务实现
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.DeptService.GetListRoleIdAsync(System.Int64)">
<summary>
通过角色id查询该角色全部部门
</summary>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.DeptService.GetListAsync(Yi.Furion.Rbac.Application.System.Dtos.Dept.DeptGetListInputVo)">
<summary>
多查
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.Impl.MenuService">
<summary>
Menu服务实现
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.MenuService.GetListRoleIdAsync(System.Int64)">
<summary>
查询当前角色的菜单
</summary>
<param name="roleId"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.Impl.PostService">
<summary>
Post服务实现
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.Impl.RoleService">
<summary>
Role服务实现
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.RoleService.CreateAsync(Yi.Furion.Rbac.Application.System.Dtos.Role.RoleCreateInputVo)">
<summary>
添加角色
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.RoleService.UpdateAsync(System.Int64,Yi.Furion.Rbac.Application.System.Dtos.Role.RoleUpdateInputVo)">
<summary>
修改角色
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.RoleService.UpdateStateAsync(System.Int64,System.Boolean)">
<summary>
更新状态
</summary>
<param name="id"></param>
<param name="state"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.Impl.UserService">
<summary>
User服务实现
</summary>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.UserService.GetListAsync(Yi.Furion.Rbac.Application.System.Dtos.User.UserGetListInputVo)">
<summary>
查询用户
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.UserService.CreateAsync(Yi.Furion.Rbac.Application.System.Dtos.User.UserCreateInputVo)">
<summary>
添加用户
</summary>
<param name="input"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.UserService.GetAsync(System.Int64)">
<summary>
单查
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.UserService.UpdateAsync(System.Int64,Yi.Furion.Rbac.Application.System.Dtos.User.UserUpdateInputVo)">
<summary>
更新用户
</summary>
<param name="id"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.UserService.UpdateProfileAsync(Yi.Furion.Rbac.Application.System.Dtos.User.ProfileUpdateInputVo)">
<summary>
更新个人中心
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Rbac.Application.System.Services.Impl.UserService.UpdateStateAsync(System.Int64,System.Boolean)">
<summary>
更新状态
</summary>
<param name="id"></param>
<param name="state"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.IPostService">
<summary>
Post服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.IRoleService">
<summary>
Role服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Rbac.Application.System.Services.IUserService">
<summary>
User服务抽象
</summary>
</member>
</members>
</doc>

View File

@@ -16,8 +16,7 @@ public class Startup : AppStartup
services.AddCorsAccessor();
services.AddControllers()
.AddInjectWithUnifyResult();
services.AddControllers().AddInject();
services.AddEventBus();
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Rbac.Web.Core
{
public class YiRESTfulResult<T>
{
public YiRESTfulResult() { }
}
}

View File

@@ -0,0 +1,57 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Furion;
using Furion.DataValidation;
using Furion.FriendlyException;
using Furion.UnifyResult;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
namespace Yi.Furion.Rbac.Web.Core
{
[UnifyModel(typeof(YiRESTfulResult<>))]
public class YiRESTfulResultProvider : IUnifyResultProvider
{
public IActionResult OnException(ExceptionContext context, ExceptionMetadata metadata)
{
return new JsonResult(new YiRESTfulResult<object>()
, UnifyContext.GetSerializerSettings(context)); // 当前行仅限 Furion 4.6.6+ 使用
}
public async Task OnResponseStatusCodes(HttpContext context, int statusCode, UnifyResultSettingsOptions unifyResultSettings = null)
{
UnifyContext.SetResponseStatusCodes(context, statusCode, unifyResultSettings);
switch (statusCode)
{
// 处理 401 状态码
case StatusCodes.Status401Unauthorized:
await context.Response.WriteAsJsonAsync(new YiRESTfulResult<object>()
, App.GetOptions<JsonOptions>()?.JsonSerializerOptions);
break;
// 处理 403 状态码
case StatusCodes.Status403Forbidden:
await context.Response.WriteAsJsonAsync(new YiRESTfulResult<object>()
, App.GetOptions<JsonOptions>()?.JsonSerializerOptions);
break;
default: break;
}
}
public IActionResult OnSucceeded(ActionExecutedContext context, object data)
{
return new JsonResult(new YiRESTfulResult<object>()
, UnifyContext.GetSerializerSettings(context)); // 当前行仅限 Furion 4.6.6+ 使用
}
public IActionResult OnValidateFailed(ActionExecutingContext context, ValidationMetadata metadata)
{
return new JsonResult(new YiRESTfulResult<object>()
, UnifyContext.GetSerializerSettings(context)); // 当前行仅限 Furion 4.6.6+ 使用
}
}
}

View File

@@ -23,6 +23,17 @@
<ItemGroup>
<ProjectReference Include="..\Yi.Furion.Rbac.Web.Core\Yi.Furion.Rbac.Web.Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ip2region.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="yi-sqlsugar-dev.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ProjectExtensions>
<VisualStudio>
<UserProperties properties_4launchsettings_1json__JsonSchema="" />

View File

@@ -22,5 +22,17 @@
"server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //Mysql
"Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //Sqlserver
]
},
"JWTSettings": {
"ValidateIssuerSigningKey": true, // 是否验证密钥bool 类型默认true
"IssuerSigningKey": "你的密钥", // 密钥string 类型必须是复杂密钥长度大于16
"ValidateIssuer": true, // 是否验证签发方bool 类型默认true
"ValidIssuer": "签发方", // 签发方string 类型
"ValidateAudience": true, // 是否验证签收方bool 类型默认true
"ValidAudience": "签收方", // 签收方string 类型
"ValidateLifetime": true, // 是否验证过期时间bool 类型默认true建议true
"ExpiredTime": 20, // 过期时间long 类型单位分钟默认20分钟
"ClockSkew": 5, // 过期时间容错值long 类型,单位秒,默认 5秒
"Algorithm": "HS256" // 加密算法string 类型,默认 HS256
}
}

Binary file not shown.