From 15db06116fbc7541806526f5db0badb15ee729b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=86=9B?= <510423039@qq.com> Date: Wed, 1 Dec 2021 13:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0=E6=9E=9A?= =?UTF-8?q?=E4=B8=BE=E6=9C=AC=E5=9C=B0=E5=8C=96=E5=8A=9F=E8=83=BD=20?= =?UTF-8?q?=E2=9C=A8=20=E5=8D=87=E7=BA=A7Abp5.0=E4=B9=8B=E5=90=8EAbpUser.I?= =?UTF-8?q?sActive=E9=BB=98=E8=AE=A4=E8=AE=BE=E7=BD=AE=E4=B8=BATrue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- aspnet-core/Directory.Build.props | 2 +- .../Users/UserAppService.cs | 2 ++ .../Lion.AbpPro.Domain.Shared.csproj | 11 +---------- .../Localization/AbpPro/en.json | 5 ++++- .../Localization/AbpPro/zh-Hans.json | 5 ++++- .../Localization/LocalizationHelper.cs | 5 +++-- .../Localizations/LocalizationHelper_Tests.cs | 18 ++++++++++++++++++ .../Localizations/TestType.cs | 9 +++++++++ 8 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/TestType.cs diff --git a/aspnet-core/Directory.Build.props b/aspnet-core/Directory.Build.props index 394847e1..aac136ea 100644 --- a/aspnet-core/Directory.Build.props +++ b/aspnet-core/Directory.Build.props @@ -10,7 +10,7 @@ 17.0.0 2.5.200 4.2.22 - + 2.2.0 2.10.0 3.0.1 1.4.0 diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs b/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs index d966a8b6..d9796531 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs +++ b/aspnet-core/services/src/Lion.AbpPro.Application/Users/UserAppService.cs @@ -66,6 +66,8 @@ namespace Lion.AbpPro.Users [Authorize(IdentityPermissions.Users.Create)] public async Task CreateAsync(IdentityUserCreateDto input) { + // abp 5.0 之后新增字段,是否运行用户登录,默认设置为true + input.IsActive = true; return await _identityUserAppService.CreateAsync(input); } diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj index e3eabc75..b68cc6df 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj +++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj @@ -9,6 +9,7 @@ + @@ -31,14 +32,4 @@ - - - C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App\6.0.0\Microsoft.AspNetCore.Http.Abstractions.dll - - - - - - - diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json index 1e152a53..897b6f19 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json +++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/en.json @@ -24,6 +24,9 @@ "Setting.Group.System": "System", "Setting.Group.Other": "Other", "DisplayName:Setting.Group.Other.Github": "Github", - "Description:Setting.Group.Other.Github": "Github" + "Description:Setting.Group.Other.Github": "Github", + "Enum:TestType:Created:1":"Created", + "Enum:TestType:Cancel:1":"Cancel", + "Enum:TestType:Delete:1":"Delete" } } diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json index 81830132..eaec699e 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json +++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/AbpPro/zh-Hans.json @@ -24,6 +24,9 @@ "Setting.Group.System": "系统", "Setting.Group.Other": "其它", "DisplayName:Setting.Group.Other.Github": "Github", - "Description:Setting.Group.Other.Github": "Github" + "Description:Setting.Group.Other.Github": "Github", + "Enum:TestType:Created:1":"创建", + "Enum:TestType:Cancel:1":"取消", + "Enum:TestType:Delete:1":"删除" } } \ No newline at end of file diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/LocalizationHelper.cs b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/LocalizationHelper.cs index ea0bda92..19a454a5 100644 --- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/LocalizationHelper.cs +++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Localization/LocalizationHelper.cs @@ -1,9 +1,10 @@ using System; -using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Localization; using Volo.Abp; using Volo.Abp.DependencyInjection; +using Microsoft.AspNetCore.Builder; + namespace Lion.AbpPro.Localization { @@ -46,7 +47,7 @@ namespace Lion.AbpPro.Localization } return StringLocalizerFactory.CreateDefaultOrNull() ?? - throw new AbpException(message: L["YH.Bee.Abp:0010"]); + throw new AbpException(message: "Localizer is null"); } diff --git a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/LocalizationHelper_Tests.cs b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/LocalizationHelper_Tests.cs index fad28ceb..dc9057b7 100644 --- a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/LocalizationHelper_Tests.cs +++ b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/LocalizationHelper_Tests.cs @@ -24,5 +24,23 @@ namespace Lion.AbpPro.Localizations enValue.Value.ShouldBe("欢迎"); } } + + [Fact] + public void Test_ToLocalicationDescription_L_OK() + { + var test = new {TestType=TestType.Cancel}; + using (CultureHelper.Use("en")) + { + var enValue = test.TestType.ToLocalicationDescription(); + enValue.ShouldBe("Cancel"); + } + + using (CultureHelper.Use("zh-Hans")) + { + + var enValue = test.TestType.ToLocalicationDescription(); + enValue.ShouldBe("取消"); + } + } } } \ No newline at end of file diff --git a/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/TestType.cs b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/TestType.cs new file mode 100644 index 00000000..d89dec5c --- /dev/null +++ b/aspnet-core/services/test/Lion.AbpPro.Domain.Tests/Localizations/TestType.cs @@ -0,0 +1,9 @@ +namespace Lion.AbpPro.Localizations +{ + public enum TestType + { + Created, + Cancel, + Delete + } +} \ No newline at end of file