From c21d1dd155eed45375a958e22f0378ebe26f62bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= <454313500@qq.com> Date: Sun, 28 Apr 2024 14:47:20 +0800 Subject: [PATCH] =?UTF-8?q?style:=20=E6=B7=BB=E5=8A=A0=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/System/UserService.cs | 11 +-- Yi.Abp.Net8/src/Yi.Abp.Web/Program.cs | 2 + .../Yi.Abp.Web/Properties/launchSettings.json | 4 +- .../src/Yi.Abp.Web/appsettings.Staging.json | 87 +++++++++++++++++++ 4 files changed, 93 insertions(+), 11 deletions(-) create mode 100644 Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.Staging.json diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs index 79d2a473..e640fca0 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application/Services/System/UserService.cs @@ -27,11 +27,10 @@ namespace Yi.Framework.Rbac.Application.Services.System public class UserService : YiCrudAppService,IUserService //IUserService { - private IDistributedCache _userCache; public UserService(ISqlSugarRepository repository, UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser, IDeptService deptService, ILocalEventBus localEventBus, IDistributedCache userCache) : base(repository) => - (_userManager, _userRepository, _currentUser, _deptService, _repository, _localEventBus, _userCache) = - (userManager, userRepository, currentUser, deptService, repository, localEventBus, userCache); + (_userManager, _userRepository, _currentUser, _deptService, _repository, _localEventBus) = + (userManager, userRepository, currentUser, deptService, repository, localEventBus); private UserManager _userManager { get; set; } private ISqlSugarRepository _repository; private IUserRepository _userRepository { get; set; } @@ -171,9 +170,6 @@ namespace Yi.Framework.Rbac.Application.Services.System var res1 = await _repository.UpdateAsync(entity); await _userManager.GiveUserSetRoleAsync(new List { id }, input.RoleIds); await _userManager.GiveUserSetPostAsync(new List { id }, input.PostIds); - - await _userCache.RefreshAsync(new UserInfoCacheKey(_currentUser.GetId())); - return await MapToGetOutputDtoAsync(entity); } @@ -190,7 +186,6 @@ namespace Yi.Framework.Rbac.Application.Services.System await _repository.UpdateAsync(entity); var dto = await MapToGetOutputDtoAsync(entity); - await _userCache.RefreshAsync(new UserInfoCacheKey(_currentUser.GetId())); return dto; } @@ -212,7 +207,6 @@ namespace Yi.Framework.Rbac.Application.Services.System } entity.State = state; await _repository.UpdateAsync(entity); - await _userCache.RefreshAsync(new UserInfoCacheKey(id)); return await MapToGetOutputDtoAsync(entity); } [OperLog("删除用户", OperEnum.Delete)] @@ -221,7 +215,6 @@ namespace Yi.Framework.Rbac.Application.Services.System { await base.DeleteAsync(id); - await _userCache.RefreshAsync(new UserInfoCacheKey(id)); } [Permission("system:user:export")] diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Program.cs b/Yi.Abp.Net8/src/Yi.Abp.Web/Program.cs index 1f0f2e2f..2d08d6d4 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Program.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Program.cs @@ -29,6 +29,8 @@ try Log.Information("Yi框架-Abp.vNext,启动!"); var builder = WebApplication.CreateBuilder(args); + Log.Information($"当前主机启动环境-【{builder.Environment.EnvironmentName}】"); + Log.Information($"当前主机启动地址-【{builder.Configuration["App:SelfUrl"]}】"); builder.WebHost.UseUrls(builder.Configuration["App:SelfUrl"]); builder.Host.UseAutofac(); builder.Host.UseSerilog(); diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json b/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json index a6df1bb6..56770734 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json @@ -5,8 +5,8 @@ "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - //,"ASPNETCORE_ENVIRONMENT": "Staging" + //"ASPNETCORE_ENVIRONMENT": "Development" + ,"ASPNETCORE_ENVIRONMENT": "Staging" }, "dotnetRunMessages": true, "applicationUrl": "http://localhost:19001" diff --git a/Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.Staging.json b/Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.Staging.json new file mode 100644 index 00000000..05bb666b --- /dev/null +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/appsettings.Staging.json @@ -0,0 +1,87 @@ +{ + "Logging": { + "LogLevel": { + //"Default": "Information", + "Default": "Debug", + "Microsoft.AspNetCore": "Warning" + } + }, + //应用启动 + "App": { + "SelfUrl": "http://*:19001", + "CorsOrigins": "http://localhost:19001;http://localhost:18000" + }, + + //数据库类型列表 + "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], + + "DbConnOptions": { + "Url": "DataSource=yi-abp-dev.db", + "DbType": "Sqlite", + "EnabledReadWrite": false, + "EnabledCodeFirst": true, + "EnabledSqlLog": true, + "EnabledDbSeed": true, + //SAAS多租户 + "EnabledSaasMultiTenancy": false + //读写分离地址 + //"ReadUrl": [ + // "DataSource=[xxxx]", //Sqlite + // "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //Mysql + // "Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //Sqlserver + //] + }, + + //redis使用freeesql参数在“FreeSqlOptions的ConnectionStringBuilder中” + "Redis": { + "IsEnabled": false, + "Configuration": "127.0.0.1:6379,password=123,defaultDatabase=13" + }, + + //鉴权 + "JwtOptions": { + "Issuer": "https://ccnetcore.com", + "Audience": "https://ccnetcore.com", + "SecurityKey": "zqxwcevrbtnymu312412ihe9rfwhe78rh23djoi32hrui3ryf9e8wfh34iuj54y0934uti4h97fgw7hf97wyh8yy69520", + "ExpiresMinuteTime": 86400 + }, + //刷新token + "RefreshJwtOptions": { + "Issuer": "https://yi.ccnetcore.com", + "Audience": "https://yi.ccnetcore.com", + "SecurityKey": "67ij4o6jo4i5j6io45j6i4j74p5k6i54ojoi5t9g8ergoj34ofgkrtbmreog894jbioemgropihj48rj4io5juopjgior", + "ExpiresMinuteTime": 172800 + }, + + + //第三方登录 + "OAuth": { + //QQ + "QQ": { + "ClientId": "", + "ClientSecret": "", + "RedirectUri": "" + }, + //码云 + "Gitee": { + "ClientId": "", + "ClientSecret": "", + "RedirectUri": "" + } + }, + + //Rbac模块 + "RbacOptions": { + //超级管理员种子数据默认密码 + "AdminPassword": "123456", + + //是否开启验证码验证 + "EnableCaptcha": true, + + //是否开启注册功能 + "EnableRegister": false, + + //开启定时数据库备份 + "EnableDataBaseBackup": false + } +}