diff --git a/Yi.Abp.Net8/Yi.Abp.sln b/Yi.Abp.Net8/Yi.Abp.sln index e063605c..38e83ef6 100644 --- a/Yi.Abp.Net8/Yi.Abp.sln +++ b/Yi.Abp.Net8/Yi.Abp.sln @@ -88,6 +88,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.Application" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Acme.BookStore.SqlSugarCore", "sample\Acme.BookStore.SqlSugarCore\Acme.BookStore.SqlSugarCore.csproj", "{70CCBD89-C0A1-4AC8-9AFA-C86C356DFDD7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Yi.Abp.Test", "test\Yi.Abp.Test\Yi.Abp.Test.csproj", "{68627BC2-F049-4C69-AD17-81DF9478E8CE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -218,6 +220,10 @@ Global {70CCBD89-C0A1-4AC8-9AFA-C86C356DFDD7}.Debug|Any CPU.Build.0 = Debug|Any CPU {70CCBD89-C0A1-4AC8-9AFA-C86C356DFDD7}.Release|Any CPU.ActiveCfg = Release|Any CPU {70CCBD89-C0A1-4AC8-9AFA-C86C356DFDD7}.Release|Any CPU.Build.0 = Release|Any CPU + {68627BC2-F049-4C69-AD17-81DF9478E8CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68627BC2-F049-4C69-AD17-81DF9478E8CE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68627BC2-F049-4C69-AD17-81DF9478E8CE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68627BC2-F049-4C69-AD17-81DF9478E8CE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -257,6 +263,7 @@ Global {20827DB5-5CDE-491A-82E8-3CAB82618C1E} = {01300F0F-686E-47B3-821D-12424177867B} {320273B6-7AE3-42DA-9675-D9AD4928A289} = {01300F0F-686E-47B3-821D-12424177867B} {70CCBD89-C0A1-4AC8-9AFA-C86C356DFDD7} = {01300F0F-686E-47B3-821D-12424177867B} + {68627BC2-F049-4C69-AD17-81DF9478E8CE} = {0D10EEF2-FBAE-4C72-B816-A52823FC299B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {23D6FBC9-C970-4641-BC1E-2AEA59F51C18} diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IAccountService.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IAccountService.cs index ed337623..046a6ada 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IAccountService.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.Application.Contracts/IServices/IAccountService.cs @@ -1,9 +1,11 @@ -using Yi.Framework.Rbac.Domain.Shared.Dtos; +using Yi.Framework.Rbac.Application.Contracts.Dtos.Account; +using Yi.Framework.Rbac.Domain.Shared.Dtos; namespace Yi.Framework.Rbac.Application.Contracts.IServices { public interface IAccountService { Task Get(); + Task PostLoginAsync(LoginInputVo input); } } 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 9d57b950..e96a231c 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 @@ -21,7 +21,7 @@ namespace Yi.Framework.Rbac.Application.Services.System /// /// User服务实现 /// - public class UserService : YiCrudAppService + public class UserService : YiCrudAppService,IUserService //IUserService { public UserService(ISqlSugarRepository repository, UserManager userManager, IUserRepository userRepository, ICurrentUser currentUser, IDeptService deptService, ILocalEventBus localEventBus) : base(repository) 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 2ab9480b..d344cba8 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json +++ b/Yi.Abp.Net8/src/Yi.Abp.Web/Properties/launchSettings.json @@ -1,15 +1,24 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", +{ "profiles": { "Yi.Abp.Web": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:19001", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:19001" + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": { + "ASPNETCORE_HTTP_PORTS": "19001" + }, + "publishAllPorts": true } - } -} + }, + "$schema": "https://json.schemastore.org/launchsettings.json" +} \ No newline at end of file diff --git a/Yi.Abp.Net8/test/Yi.Abp.Test/User/User_Test.cs b/Yi.Abp.Net8/test/Yi.Abp.Test/User/User_Test.cs new file mode 100644 index 00000000..acab6cec --- /dev/null +++ b/Yi.Abp.Net8/test/Yi.Abp.Test/User/User_Test.cs @@ -0,0 +1,18 @@ +using Shouldly; +using Xunit; +using Yi.Framework.Rbac.Application.Contracts.IServices; +using Yi.Framework.Rbac.Domain.Shared.Consts; + +namespace Yi.Abp.Test.Application +{ + public class User_Test : YiAbpTestBase + { + [Fact] + public async Task Get_User_List_Test() + { + var service = GetRequiredService(); + var user = await service.GetListAsync(new Framework.Rbac.Application.Contracts.Dtos.User.UserGetListInputVo { UserName = UserConst.Admin }); + user.ShouldNotBeNull(); + } + } +} diff --git a/Yi.Abp.Net8/test/Yi.Abp.Test/Yi.Abp.Test.csproj b/Yi.Abp.Net8/test/Yi.Abp.Test/Yi.Abp.Test.csproj new file mode 100644 index 00000000..bf1dbd58 --- /dev/null +++ b/Yi.Abp.Net8/test/Yi.Abp.Test/Yi.Abp.Test.csproj @@ -0,0 +1,46 @@ + + + + net8.0 + enable + enable + + + + + + + + PreserveNewest + true + PreserveNewest + + + Always + true + PreserveNewest + + + + + + + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + + + + + diff --git a/Yi.Abp.Net8/test/Yi.Abp.Test/YiAbpTestBase.cs b/Yi.Abp.Net8/test/Yi.Abp.Test/YiAbpTestBase.cs new file mode 100644 index 00000000..ef184aca --- /dev/null +++ b/Yi.Abp.Net8/test/Yi.Abp.Test/YiAbpTestBase.cs @@ -0,0 +1,56 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Volo.Abp; +using Yi.Framework.Rbac.Domain.Repositories; +using Yi.Framework.Rbac.SqlSugarCore.Repositories; + +namespace Yi.Abp.Test +{ + public class YiAbpTestBase :AbpTestBaseWithServiceProvider + { + public ILogger Logger { get; private set; } + protected IServiceScope TestServiceScope { get; } + public YiAbpTestBase() + { + IAbpApplicationWithExternalServiceProvider application = null; + IHost host = Host.CreateDefaultBuilder() + .UseAutofac() + .ConfigureServices((host, service) => + { + service.AddLogging(builder => builder.ClearProviders().AddConsole().AddDebug()); + /*application= */ + service.AddApplicationAsync().Wait(); + this.ConfigureServices(host, service); + }) + .ConfigureAppConfiguration(this.ConfigureAppConfiguration) + .Build(); + + this.ServiceProvider = host.Services; + this.TestServiceScope = ServiceProvider.CreateScope(); + this.Logger = (ILogger)this.ServiceProvider.GetRequiredService(typeof(ILogger<>).MakeGenericType(this.GetType())); + + //host.InitializeAsync().Wait(); + this.Configure(); + } + + + + protected virtual void ConfigureServices(HostBuilderContext context, IServiceCollection services) + { + services.AddTransient(); + } + + protected virtual void ConfigureAppConfiguration(IConfigurationBuilder configurationBuilder) + { + configurationBuilder.AddJsonFile("appsettings.json"); + //configurationBuilder.AddJsonFile("appsettings.Development.json"); + + } + + protected virtual void Configure() + { + } + } +} diff --git a/Yi.Abp.Net8/test/Yi.Abp.Test/YiAbpTestModule.cs b/Yi.Abp.Net8/test/Yi.Abp.Test/YiAbpTestModule.cs new file mode 100644 index 00000000..3a6d72a1 --- /dev/null +++ b/Yi.Abp.Net8/test/Yi.Abp.Test/YiAbpTestModule.cs @@ -0,0 +1,28 @@ +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Auditing; +using Volo.Abp.Authorization; +using Volo.Abp.Autofac; +using Volo.Abp.Modularity; +using Yi.Abp.Application; +using Yi.Abp.SqlsugarCore; +using Yi.Framework.Rbac.SqlSugarCore; +using Yi.Framework.SqlSugarCore; + +namespace Yi.Abp.Test +{ + [DependsOn( + typeof(YiAbpSqlSugarCoreModule), + typeof(YiAbpApplicationModule), + + typeof(AbpAutofacModule), + typeof(AbpAuditingModule) + )] + public class YiAbpTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.GetConfiguration(); + } + } +} diff --git a/Yi.Abp.Net8/test/Yi.Abp.Test/appsettings.Development.json b/Yi.Abp.Net8/test/Yi.Abp.Test/appsettings.Development.json new file mode 100644 index 00000000..90dbb403 --- /dev/null +++ b/Yi.Abp.Net8/test/Yi.Abp.Test/appsettings.Development.json @@ -0,0 +1,42 @@ +{ + //Rbac模块 + "RbacOptions": { + //超级管理员种子数据默认密码 + "AdminPassword": "cc2016cc", + + //是否开启验证码验证 + "EnableCaptcha": false, + + //是否开启注册功能 + "EnableRegister": true, + + //开启定时数据库备份 + "EnableDataBaseBackup": true + + }, + "DbConnOptions": { + "Url": "server=106.52.94.217;port=3306;database=yi-abp-pro;user id=root;password=Qz52013142020.", + //"Url": "server=localhost;port=3306;database=yi-abp-pro;user id=root;password=root", + "DbType": "Mysql", + "EnabledReadWrite": false, + "EnabledCodeFirst": false, + "EnabledSqlLog": true, + "EnabledDbSeed": 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 + //] + }, + + //阿里云配置 + "AliyunOptions": { + "AccessKeyId": "LTAI5tGdhAvUMzJtgcAz1yrZ", + "AccessKeySecret": "NuqdEs3Jf0lAs30JP7d4T7jvI1AFgr", + "Sms": { + "SignName": "ccnetcore", + "TemplateCode": "SMS_275415076" + } + } +} diff --git a/Yi.Abp.Net8/test/Yi.Abp.Test/appsettings.json b/Yi.Abp.Net8/test/Yi.Abp.Test/appsettings.json new file mode 100644 index 00000000..5ee98247 --- /dev/null +++ b/Yi.Abp.Net8/test/Yi.Abp.Test/appsettings.json @@ -0,0 +1,71 @@ +{ + "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 + //读写分离地址 + //"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 + //] + }, + + //鉴权 + "JwtOptions": { + "Issuer": "https://ccnetcore.com", + "Audience": "https://ccnetcore.com", + "SecurityKey": "zqxwcevrbtnymu312412ihe9rfwhe78rh23djoi32hrui3ryf9e8wfh34iuj54y0934uti4h97fgw7hf97wyh8yy69520", + "ExpiresMinuteTime": 86400 + }, + + //第三方登录 + "OAuth": { + //QQ + "QQ": { + "ClientId": "", + "ClientSecret": "", + "RedirectUri": "" + }, + //码云 + "Gitee": { + "ClientId": "", + "ClientSecret": "", + "RedirectUri": "" + } + }, + + //Rbac模块 + "RbacOptions": { + //超级管理员种子数据默认密码 + "AdminPassword": "123456", + + //是否开启验证码验证 + "EnableCaptcha": true, + + //是否开启注册功能 + "EnableRegister": false, + + //开启定时数据库备份 + "EnableDataBaseBackup": false + } +}