Browse Source

Upgrade abp framework to 6.0.2

* Upgrade abp framework to 6.0.2.

* Update dapr package.

* Update agile-config package.

* Update stack-exchange-redis package.

* Remove versions manager.

* Add packages manager.
pull/748/head
cKey 3 years ago
parent
commit
6f5860cc43
  1. 10
      aspnet-core/Directory.Build.props
  2. 15
      aspnet-core/LINGYUN.MicroService.All.sln
  3. 8
      aspnet-core/common.props
  4. 38
      aspnet-core/modules/caching/LINGYUN.Abp.CachingManagement.HttpApi/LINGYUN.Abp.CachingManagement.HttpApi.csproj
  5. 19
      aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs
  6. 6
      aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateOptions.cs
  7. 5
      aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/LocalFileCreateProjectService.cs
  8. 5
      aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/ProjectCreateArgs.cs
  9. 3
      aspnet-core/modules/cli/LINGYUN.Abp.Cli/Properties/launchSettings.json
  10. 30
      aspnet-core/modules/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN.Abp.Data.DbMigrator.csproj
  11. 40
      aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj
  12. 32
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Actors.AspNetCore.Wrapper/LINGYUN.Abp.Dapr.Actors.AspNetCore.Wrapper.csproj
  13. 32
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Actors.AspNetCore/LINGYUN.Abp.Dapr.Actors.AspNetCore.csproj
  14. 30
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Actors/LINGYUN.Abp.Dapr.Actors.csproj
  15. 32
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client.Wrapper/LINGYUN.Abp.Dapr.Client.Wrapper.csproj
  16. 26
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client.Wrapper/LINGYUN/Abp/Dapr/Client/Wrapper/AbpDaprClientWrapperModule.cs
  17. 38
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client/LINGYUN.Abp.Dapr.Client.csproj
  18. 13
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client/LINGYUN/Abp/Dapr/Client/ClientProxying/AbpDaprClientProxyOptions.cs
  19. 13
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client/LINGYUN/Abp/Dapr/Client/ClientProxying/DaprClientProxyBase.cs
  20. 32
      aspnet-core/modules/dapr/LINGYUN.Abp.Dapr/LINGYUN.Abp.Dapr.csproj
  21. 42
      aspnet-core/modules/dapr/LINGYUN.Abp.DistributedLocking.Dapr/LINGYUN.Abp.DistributedLocking.Dapr.csproj
  22. 40
      aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN.Abp.DataProtection.EntityFrameworkCore.csproj
  23. 40
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN.Abp.IdentityServer.Application.csproj
  24. 46
      aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj
  25. 30
      aspnet-core/modules/localization/LINGYUN.Abp.Localization.CultureMap/LINGYUN.Abp.Localization.CultureMap.csproj
  26. 38
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj
  27. 32
      aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.HttpApi/LINGYUN.Abp.LocalizationManagement.HttpApi.csproj
  28. 12
      aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Tencent/Properties/launchSettings.json
  29. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobDownloadInput.cs
  30. 21
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobDto.cs
  31. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobRemoveDto.cs
  32. 36
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobUploadDto.cs
  33. 19
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageCreateDto.cs
  34. 28
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageCreateOrUpdateDto.cs
  35. 46
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageDto.cs
  36. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageGetLatestInput.cs
  37. 26
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageGetPagedListInput.cs
  38. 8
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageUpdateDto.cs
  39. 29
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/IPackageAppService.cs
  40. 15
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs
  41. 15
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs
  42. 33
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionCreateDto.cs
  43. 13
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDeleteDto.cs
  44. 34
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDto.cs
  45. 51
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileCreateDto.cs
  46. 15
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDeleteDto.cs
  47. 33
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDto.cs
  48. 24
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileGetDto.cs
  49. 9
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionGetByIdDto.cs
  50. 10
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionGetByPagedDto.cs
  51. 27
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/IVersionAppService.cs
  52. 187
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Packages/PackageAppService.cs
  53. 6
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs
  54. 103
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Versions/VersionAppService.cs
  55. 1
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json
  56. 1
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json
  57. 2
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatformModuleExtensionConsts.cs
  58. 4
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatfromModuleExtensionConfiguration.cs
  59. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageBlobConsts.cs
  60. 10
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageConsts.cs
  61. 24
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageEto.cs
  62. 17
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageLevel.cs
  63. 4
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs
  64. 14
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/AppVersionConsts.cs
  65. 33
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/AppVersionEto.cs
  66. 21
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/FileType.cs
  67. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/IVersionFileManager.cs
  68. 22
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/ImportantLevel.cs
  69. 13
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/VersionFileConsts.cs
  70. 20
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/FileSystemPackageBlobNormalizer.cs
  71. 25
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/IPackageBlobManager.cs
  72. 6
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/IPackageBlobNormalizer.cs
  73. 32
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/IPackageRepository.cs
  74. 114
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/Package.cs
  75. 64
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageBlob.cs
  76. 94
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageBlobManager.cs
  77. 8
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageContainer.cs
  78. 36
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageFilter.cs
  79. 31
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageSpecification.cs
  80. 6
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs
  81. 14
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs
  82. 31
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Settings/PlatformSettingDefinitionProvider.cs
  83. 116
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/AppVersion.cs
  84. 21
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/IVersionRepository.cs
  85. 9
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionContainer.cs
  86. 102
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionFile.cs
  87. 153
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionManager.cs
  88. 32
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/Linq/Expressions/ExpressionFuncExtensions.cs
  89. 4
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs
  90. 5
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs
  91. 81
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs
  92. 13
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs
  93. 11
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs
  94. 80
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs
  95. 68
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Versions/EfCoreVersionRepository.cs
  96. 97
      aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Packages/PackageController.cs
  97. 224
      aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs
  98. 2
      aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobSimpleAdapter.cs
  99. 12
      aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.Saas/Properties/launchSettings.json
  100. 38
      aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj

10
aspnet-core/Directory.Build.props

@ -1,15 +1,15 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<VoloAbpPackageVersion>6.0.1</VoloAbpPackageVersion> <VoloAbpPackageVersion>6.0.2</VoloAbpPackageVersion>
<LINGYUNAbpPackageVersion>6.0.1</LINGYUNAbpPackageVersion> <LINGYUNAbpPackageVersion>6.0.2</LINGYUNAbpPackageVersion>
<DaprPackageVersion>1.8.0</DaprPackageVersion> <DaprPackageVersion>1.9.0</DaprPackageVersion>
<DistributedLockRedisPackageVersion>1.0.2</DistributedLockRedisPackageVersion> <DistributedLockRedisPackageVersion>1.0.2</DistributedLockRedisPackageVersion>
<DotNetCoreCAPPackageVersion>7.0.0</DotNetCoreCAPPackageVersion> <DotNetCoreCAPPackageVersion>7.0.0</DotNetCoreCAPPackageVersion>
<ElsaPackageVersion>2.9.0</ElsaPackageVersion> <ElsaPackageVersion>2.9.0</ElsaPackageVersion>
<AliyunSDKPackageVersion>1.5.10</AliyunSDKPackageVersion> <AliyunSDKPackageVersion>1.5.10</AliyunSDKPackageVersion>
<AliyunOSSSDKPackageVersion>2.13.0</AliyunOSSSDKPackageVersion> <AliyunOSSSDKPackageVersion>2.13.0</AliyunOSSSDKPackageVersion>
<TencentCloudSDKPackageVersion>3.0.434</TencentCloudSDKPackageVersion> <TencentCloudSDKPackageVersion>3.0.434</TencentCloudSDKPackageVersion>
<AgileConfigClientPackageVersion>1.2.1.5</AgileConfigClientPackageVersion> <AgileConfigClientPackageVersion>1.6.9</AgileConfigClientPackageVersion>
<HangfireMySqlStoragePackageVersion>2.0.3</HangfireMySqlStoragePackageVersion> <HangfireMySqlStoragePackageVersion>2.0.3</HangfireMySqlStoragePackageVersion>
<HangfireMSSQLStoragePackageVersion>1.7.29</HangfireMSSQLStoragePackageVersion> <HangfireMSSQLStoragePackageVersion>1.7.29</HangfireMSSQLStoragePackageVersion>
<NESTPackageVersion>7.15.1</NESTPackageVersion> <NESTPackageVersion>7.15.1</NESTPackageVersion>
@ -19,7 +19,7 @@
<OpenTelemetryInstrumentationHttpPackageVersion>1.0.0-rc8</OpenTelemetryInstrumentationHttpPackageVersion> <OpenTelemetryInstrumentationHttpPackageVersion>1.0.0-rc8</OpenTelemetryInstrumentationHttpPackageVersion>
<OpenTelemetryContribInstrumentationEntityFrameworkCorePackageVersion>1.0.0-beta2</OpenTelemetryContribInstrumentationEntityFrameworkCorePackageVersion> <OpenTelemetryContribInstrumentationEntityFrameworkCorePackageVersion>1.0.0-beta2</OpenTelemetryContribInstrumentationEntityFrameworkCorePackageVersion>
<QuartzNETPackageVersion>3.3.3</QuartzNETPackageVersion> <QuartzNETPackageVersion>3.3.3</QuartzNETPackageVersion>
<StackExchangeRedisPackageVersion>2.0.593</StackExchangeRedisPackageVersion> <StackExchangeRedisPackageVersion>2.2.4</StackExchangeRedisPackageVersion>
<SerilogPackageVersion>2.10.0</SerilogPackageVersion> <SerilogPackageVersion>2.10.0</SerilogPackageVersion>
<SerilogAspNetCorePackageVersion>5.0.0</SerilogAspNetCorePackageVersion> <SerilogAspNetCorePackageVersion>5.0.0</SerilogAspNetCorePackageVersion>
<SerilogEnrichersEnvironmentPackageVersion>2.2.0</SerilogEnrichersEnvironmentPackageVersion> <SerilogEnrichersEnvironmentPackageVersion>2.2.0</SerilogEnrichersEnvironmentPackageVersion>

15
aspnet-core/LINGYUN.MicroService.All.sln

@ -352,6 +352,9 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A76A4741-AF91-44EF-A7B6-8E7AF4961146}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A76A4741-AF91-44EF-A7B6-8E7AF4961146}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig .editorconfig = .editorconfig
common.props = common.props
configureawait.props = configureawait.props
Directory.Build.props = Directory.Build.props
EndProjectSection EndProjectSection
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Tencent.SettingManagement", "modules\cloud-tencent\LINGYUN.Abp.Tencent.SettingManagement\LINGYUN.Abp.Tencent.SettingManagement.csproj", "{C7CF4193-6397-4450-AF42-3BACD7CF292E}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.Tencent.SettingManagement", "modules\cloud-tencent\LINGYUN.Abp.Tencent.SettingManagement\LINGYUN.Abp.Tencent.SettingManagement.csproj", "{C7CF4193-6397-4450-AF42-3BACD7CF292E}"
@ -502,12 +505,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.OpenIddict.WeCh
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.IdGenerator.Tests", "tests\LINGYUN.Abp.IdGenerator.Tests\LINGYUN.Abp.IdGenerator.Tests.csproj", "{2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.IdGenerator.Tests", "tests\LINGYUN.Abp.IdGenerator.Tests\LINGYUN.Abp.IdGenerator.Tests.csproj", "{2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Solution Items", ".Solution Items", "{7D604751-3FA4-4826-A93B-BBC10D73C861}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.WeChat.Official.Senparc", "modules\wechat\LINGYUN.Abp.WeChat.Official.Senparc\LINGYUN.Abp.WeChat.Official.Senparc.csproj", "{CA8D7141-9520-46AC-83FD-6E034AD6EBDD}"
ProjectSection(SolutionItems) = preProject
common.props = common.props
configureawait.props = configureawait.props
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -1307,6 +1305,10 @@ Global
{2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}.Release|Any CPU.Build.0 = Release|Any CPU {2BFFE9C3-E022-4B57-9E4D-0A0408424B1A}.Release|Any CPU.Build.0 = Release|Any CPU
{CA8D7141-9520-46AC-83FD-6E034AD6EBDD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CA8D7141-9520-46AC-83FD-6E034AD6EBDD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CA8D7141-9520-46AC-83FD-6E034AD6EBDD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CA8D7141-9520-46AC-83FD-6E034AD6EBDD}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -1553,6 +1555,7 @@ Global
{74C13BCC-A5A5-40FA-81E8-83DCCF760148} = {83E698F6-F8CD-4604-AB80-01A203389501} {74C13BCC-A5A5-40FA-81E8-83DCCF760148} = {83E698F6-F8CD-4604-AB80-01A203389501}
{427382F6-3153-47A2-BBC4-88F6EA116A8F} = {83E698F6-F8CD-4604-AB80-01A203389501} {427382F6-3153-47A2-BBC4-88F6EA116A8F} = {83E698F6-F8CD-4604-AB80-01A203389501}
{2BFFE9C3-E022-4B57-9E4D-0A0408424B1A} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F} {2BFFE9C3-E022-4B57-9E4D-0A0408424B1A} = {370D7CD5-1E17-4F3D-BBFA-03429F6D4F2F}
{CA8D7141-9520-46AC-83FD-6E034AD6EBDD} = {DD9BE9E7-F6BF-4869-BCD2-82F5072BDA21}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718}

8
aspnet-core/common.props

@ -1,7 +1,7 @@
<Project> <Project>
<PropertyGroup> <PropertyGroup>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Version>6.0.1</Version> <Version>6.0.2</Version>
<Authors>colin</Authors> <Authors>colin</Authors>
<NoWarn>$(NoWarn);CS1591;CS0436;CS8618;NU1803</NoWarn> <NoWarn>$(NoWarn);CS1591;CS0436;CS8618;NU1803</NoWarn>
<PackageProjectUrl>https://github.com/colinin/abp-next-admin</PackageProjectUrl> <PackageProjectUrl>https://github.com/colinin/abp-next-admin</PackageProjectUrl>
@ -17,6 +17,12 @@
<None Remove="LocalNuget\**" /> <None Remove="LocalNuget\**" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<EmbeddedResource Remove="Logs\**" />
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Modules\**" /> <Compile Remove="Modules\**" />
<EmbeddedResource Remove="Modules\**" /> <EmbeddedResource Remove="Modules\**" />

38
aspnet-core/modules/caching/LINGYUN.Abp.CachingManagement.HttpApi/LINGYUN.Abp.CachingManagement.HttpApi.csproj

@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.CachingManagement.Application.Contracts\LINGYUN.Abp.CachingManagement.Application.Contracts.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.CachingManagement.Application.Contracts\LINGYUN.Abp.CachingManagement.Application.Contracts.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

19
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateCommand.cs

@ -114,6 +114,12 @@ namespace LINGYUN.Abp.Cli.Commands
Logger.LogInformation("DBMS: " + databaseManagementSystem); Logger.LogInformation("DBMS: " + databaseManagementSystem);
} }
var authenticationScheme = GetAuthenticationScheme(commandLineArgs);
if (!authenticationScheme.IsNullOrWhiteSpace())
{
Logger.LogInformation("Authentication Scheme: " + authenticationScheme);
}
var randomPort = string.IsNullOrWhiteSpace( var randomPort = string.IsNullOrWhiteSpace(
commandLineArgs.Options.GetOrNull(CreateOptions.NoRandomPort.Short, CreateOptions.NoRandomPort.Long)); commandLineArgs.Options.GetOrNull(CreateOptions.NoRandomPort.Short, CreateOptions.NoRandomPort.Long));
var applicationPort = randomPort ? RandomHelper.GetRandom(5001, 65535).ToString() : "5000"; var applicationPort = randomPort ? RandomHelper.GetRandom(5001, 65535).ToString() : "5000";
@ -166,7 +172,8 @@ namespace LINGYUN.Abp.Cli.Commands
commandLineArgs.Options, commandLineArgs.Options,
connectionString, connectionString,
applicationPort, applicationPort,
daprPort daprPort,
authenticationScheme
); );
await CreateProjectService.CreateAsync(projectArgs); await CreateProjectService.CreateAsync(projectArgs);
@ -197,6 +204,7 @@ namespace LINGYUN.Abp.Cli.Commands
sb.AppendLine("-csf|--create-solution-folder (default: true)"); sb.AppendLine("-csf|--create-solution-folder (default: true)");
sb.AppendLine("-cs|--connection-string <connection-string> (your database connection string)"); sb.AppendLine("-cs|--connection-string <connection-string> (your database connection string)");
sb.AppendLine("--dbms <database-management-system> (your database management system)"); sb.AppendLine("--dbms <database-management-system> (your database management system)");
sb.AppendLine("--as <authentication-scheme> (your identity authentication provider, optional: IdentityServer4、OpenIddict, default: IdentityServer4)");
sb.AppendLine("--no-random-port (Use template's default ports)"); sb.AppendLine("--no-random-port (Use template's default ports)");
sb.AppendLine(""); sb.AppendLine("");
sb.AppendLine("Examples:"); sb.AppendLine("Examples:");
@ -209,6 +217,7 @@ namespace LINGYUN.Abp.Cli.Commands
sb.AppendLine(" labp create Acme.BookStore -csf false"); sb.AppendLine(" labp create Acme.BookStore -csf false");
sb.AppendLine(" labp create Acme.BookStore --local-framework-ref --abp-path \"D:\\github\\abp\""); sb.AppendLine(" labp create Acme.BookStore --local-framework-ref --abp-path \"D:\\github\\abp\"");
sb.AppendLine(" labp create Acme.BookStore --dbms mysql"); sb.AppendLine(" labp create Acme.BookStore --dbms mysql");
sb.AppendLine(" labp create Acme.BookStore --as openiddict");
sb.AppendLine(" labp create Acme.BookStore --connection-string \"Server=myServerName\\myInstanceName;Database=myDatabase;User Id=myUsername;Password=myPassword\""); sb.AppendLine(" labp create Acme.BookStore --connection-string \"Server=myServerName\\myInstanceName;Database=myDatabase;User Id=myUsername;Password=myPassword\"");
sb.AppendLine(""); sb.AppendLine("");
// TODO: 文档 // TODO: 文档
@ -223,6 +232,14 @@ namespace LINGYUN.Abp.Cli.Commands
|| commandLineArgs.Options.ContainsKey(NewCommand.Options.CreateSolutionFolder.Short); || commandLineArgs.Options.ContainsKey(NewCommand.Options.CreateSolutionFolder.Short);
} }
protected virtual string GetAuthenticationScheme(CommandLineArgs commandLineArgs)
{
var authScheme = commandLineArgs.Options.GetOrNull(
CreateOptions.AuthenticationScheme.Short,
CreateOptions.AuthenticationScheme.Long);
return string.IsNullOrWhiteSpace(authScheme) ? "IdentityServer4" : authScheme;
}
protected virtual DatabaseProvider GetDatabaseProvider(CommandLineArgs commandLineArgs) protected virtual DatabaseProvider GetDatabaseProvider(CommandLineArgs commandLineArgs)
{ {
var optionValue = commandLineArgs.Options.GetOrNull( var optionValue = commandLineArgs.Options.GetOrNull(

6
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/CreateOptions.cs

@ -21,5 +21,11 @@
public const string Short = "nrp"; public const string Short = "nrp";
public const string Long = "no-random-port"; public const string Long = "no-random-port";
} }
public static class AuthenticationScheme
{
public const string Short = "as";
public const string Long = "auth-scheme";
}
} }
} }

5
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/LocalFileCreateProjectService.cs

@ -63,6 +63,9 @@ namespace LINGYUN.Abp.Cli.Commands
commandBuilder.AppendFormat(" -n {0}", createArgs.SolutionName.ProjectName); commandBuilder.AppendFormat(" -n {0}", createArgs.SolutionName.ProjectName);
commandBuilder.AppendFormat(" -o {0}", createArgs.OutputFolder); commandBuilder.AppendFormat(" -o {0}", createArgs.OutputFolder);
commandBuilder.AppendFormat(" --DatabaseManagement {0}", dbm); commandBuilder.AppendFormat(" --DatabaseManagement {0}", dbm);
commandBuilder.AppendFormat(" --AuthenticationScheme {0}", createArgs.AuthenticationScheme);
Logger.LogInformation("Execute command: " + commandBuilder.ToString());
var cmdError = CmdHelper.RunCmdAndGetOutput(commandBuilder.ToString(), out bool isSuccessful); var cmdError = CmdHelper.RunCmdAndGetOutput(commandBuilder.ToString(), out bool isSuccessful);
if (!isSuccessful) if (!isSuccessful)
@ -71,7 +74,7 @@ namespace LINGYUN.Abp.Cli.Commands
return; return;
} }
Logger.LogInformation("Execute command: " + cmdError); Logger.LogInformation("Executed command: " + cmdError);
var projectFiles = new List<FindFile>(); var projectFiles = new List<FindFile>();

5
aspnet-core/modules/cli/LINGYUN.Abp.Cli/LINGYUN/Abp/Cli/Commands/ProjectCreateArgs.cs

@ -9,6 +9,7 @@ namespace LINGYUN.Abp.Cli.Commands
public string PackageName { get; } public string PackageName { get; }
public string ApplicationPort { get; } public string ApplicationPort { get; }
public string DaprPort { get; } public string DaprPort { get; }
public string AuthenticationScheme { get; }
public ProjectCreateArgs( public ProjectCreateArgs(
string packageName, string packageName,
SolutionName solutionName, SolutionName solutionName,
@ -26,7 +27,8 @@ namespace LINGYUN.Abp.Cli.Commands
Dictionary<string, string> extraProperties = null, Dictionary<string, string> extraProperties = null,
string connectionString = null, string connectionString = null,
string applicationPort = "5000", string applicationPort = "5000",
string daprPort = "3500") string daprPort = "3500",
string authenticationScheme = "IdentityServer4")
: base( : base(
solutionName, solutionName,
templateName, templateName,
@ -46,6 +48,7 @@ namespace LINGYUN.Abp.Cli.Commands
PackageName = packageName; PackageName = packageName;
ApplicationPort = applicationPort; ApplicationPort = applicationPort;
DaprPort = daprPort; DaprPort = daprPort;
AuthenticationScheme = authenticationScheme;
} }
} }
} }

3
aspnet-core/modules/cli/LINGYUN.Abp.Cli/Properties/launchSettings.json

@ -1,7 +1,8 @@
{ {
"profiles": { "profiles": {
"LINGYUN.Abp.Cli": { "LINGYUN.Abp.Cli": {
"commandName": "Project" "commandName": "Project",
"commandLineArgs": "help create"
} }
} }
} }

30
aspnet-core/modules/common/LINGYUN.Abp.Data.DbMigrator/LINGYUN.Abp.Data.DbMigrator.csproj

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

40
aspnet-core/modules/common/LINGYUN.Abp.EventBus.CAP/LINGYUN.Abp.EventBus.CAP.csproj

@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
<Description>Cap分布式事件总线</Description> <Description>Cap分布式事件总线</Description>
<GenerateDocumentationFile>true</GenerateDocumentationFile> <GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>$(SolutionDir)modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.xml</DocumentationFile> <DocumentationFile>$(SolutionDir)modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.xml</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="DotNetCore.CAP" Version="$(DotNetCoreCAPPackageVersion)" /> <PackageReference Include="DotNetCore.CAP" Version="$(DotNetCoreCAPPackageVersion)" />
<PackageReference Include="Volo.Abp.EventBus" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.EventBus" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.Json" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.Json" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

32
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Actors.AspNetCore.Wrapper/LINGYUN.Abp.Dapr.Actors.AspNetCore.Wrapper.csproj

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj" /> <ProjectReference Include="..\..\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Dapr.Actors.AspNetCore\LINGYUN.Abp.Dapr.Actors.AspNetCore.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.Dapr.Actors.AspNetCore\LINGYUN.Abp.Dapr.Actors.AspNetCore.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

32
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Actors.AspNetCore/LINGYUN.Abp.Dapr.Actors.AspNetCore.csproj

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapr.Actors.AspNetCore" Version="$(DaprPackageVersion)" /> <PackageReference Include="Dapr.Actors.AspNetCore" Version="$(DaprPackageVersion)" />
<PackageReference Include="Volo.Abp.AspNetCore" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.AspNetCore" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

30
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Actors/LINGYUN.Abp.Dapr.Actors.csproj

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapr.Actors" Version="$(DaprPackageVersion)" /> <PackageReference Include="Dapr.Actors" Version="$(DaprPackageVersion)" />
<PackageReference Include="Volo.Abp.Http.Client" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.Http.Client" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

32
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client.Wrapper/LINGYUN.Abp.Dapr.Client.Wrapper.csproj

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj" /> <ProjectReference Include="..\..\common\LINGYUN.Abp.Wrapper\LINGYUN.Abp.Wrapper.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.Dapr.Client\LINGYUN.Abp.Dapr.Client.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.Dapr.Client\LINGYUN.Abp.Dapr.Client.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

26
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client.Wrapper/LINGYUN/Abp/Dapr/Client/Wrapper/AbpDaprClientWrapperModule.cs

@ -58,6 +58,32 @@ namespace LINGYUN.Abp.Dapr.Client.Wrapper
return stringContent; return stringContent;
}); });
options.OnError(async (response, serviceProvider) =>
{
if (response.Headers.Contains(AbpHttpWrapConsts.AbpWrapResult))
{
try
{
var jsonSerializer = serviceProvider.LazyGetRequiredService<IJsonSerializer>();
var result = jsonSerializer.Deserialize<WrapResult>(
await response.Content.ReadAsStringAsync());
return new RemoteServiceErrorInfo(
result.Message,
result.Details,
result.Code);
}
catch
{
return new RemoteServiceErrorInfo
{
Message = response.ReasonPhrase,
Code = response.StatusCode.ToString()
};
}
}
return null;
});
}); });
} }
} }

38
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client/LINGYUN.Abp.Dapr.Client.csproj

@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Http.Client" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.Http.Client" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Dapr\LINGYUN.Abp.Dapr.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.Dapr\LINGYUN.Abp.Dapr.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

13
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client/LINGYUN/Abp/Dapr/Client/ClientProxying/AbpDaprClientProxyOptions.cs

@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Http;
namespace LINGYUN.Abp.Dapr.Client.ClientProxying namespace LINGYUN.Abp.Dapr.Client.ClientProxying
{ {
@ -20,6 +21,10 @@ namespace LINGYUN.Abp.Dapr.Client.ClientProxying
/// 对响应进行处理,返回响应内容 /// 对响应进行处理,返回响应内容
/// </summary> /// </summary>
public Func<HttpResponseMessage, IAbpLazyServiceProvider, Task<string>> ProxyResponseContent { get; private set; } public Func<HttpResponseMessage, IAbpLazyServiceProvider, Task<string>> ProxyResponseContent { get; private set; }
/// <summary>
/// 格式化错误
/// </summary>
public Func<HttpResponseMessage, IAbpLazyServiceProvider, Task<RemoteServiceErrorInfo>> ProxyErrorFormat { get; private set; }
public AbpDaprClientProxyOptions() public AbpDaprClientProxyOptions()
{ {
DaprClientProxies = new Dictionary<Type, DynamicDaprClientProxyConfig>(); DaprClientProxies = new Dictionary<Type, DynamicDaprClientProxyConfig>();
@ -38,5 +43,13 @@ namespace LINGYUN.Abp.Dapr.Client.ClientProxying
{ {
ProxyResponseContent = func; ProxyResponseContent = func;
} }
/// <summary>
/// 处理服务间调用错误消息
/// </summary>
/// <param name="func"></param>
public void OnError(Func<HttpResponseMessage, IAbpLazyServiceProvider, Task<RemoteServiceErrorInfo>> func)
{
ProxyErrorFormat = func;
}
} }
} }

13
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr.Client/LINGYUN/Abp/Dapr/Client/ClientProxying/DaprClientProxyBase.cs

@ -6,6 +6,8 @@ using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Content; using Volo.Abp.Content;
using Volo.Abp.Http.Client;
using Volo.Abp.Http;
using Volo.Abp.Http.Client.Authentication; using Volo.Abp.Http.Client.Authentication;
using Volo.Abp.Http.Client.ClientProxying; using Volo.Abp.Http.Client.ClientProxying;
@ -115,6 +117,17 @@ namespace LINGYUN.Abp.Dapr.Client.ClientProxying
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
if (DaprClientProxyOptions.Value.ProxyErrorFormat != null)
{
var errorInfo = await DaprClientProxyOptions.Value.ProxyErrorFormat(response, LazyServiceProvider);
if (errorInfo != null)
{
throw new AbpRemoteCallException(errorInfo)
{
HttpStatusCode = (int)response.StatusCode
};
}
}
await ThrowExceptionForResponseAsync(response); await ThrowExceptionForResponseAsync(response);
} }

32
aspnet-core/modules/dapr/LINGYUN.Abp.Dapr/LINGYUN.Abp.Dapr.csproj

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Json" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.Json" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Dapr.Client" Version="$(DaprPackageVersion)" /> <PackageReference Include="Dapr.Client" Version="$(DaprPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

42
aspnet-core/modules/dapr/LINGYUN.Abp.DistributedLocking.Dapr/LINGYUN.Abp.DistributedLocking.Dapr.csproj

@ -1,21 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Threading" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.Threading" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Volo.Abp.DistributedLocking.Abstractions" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.DistributedLocking.Abstractions" Version="$(VoloAbpPackageVersion)" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftPackageVersion)" /> <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.Dapr\LINGYUN.Abp.Dapr.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.Dapr\LINGYUN.Abp.Dapr.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

40
aspnet-core/modules/data-protection/LINGYUN.Abp.DataProtection.EntityFrameworkCore/LINGYUN.Abp.DataProtection.EntityFrameworkCore.csproj

@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.DataProtection\LINGYUN.Abp.DataProtection.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.DataProtection\LINGYUN.Abp.DataProtection.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

40
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.Application/LINGYUN.Abp.IdentityServer.Application.csproj

@ -1,20 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.Ddd.Application" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.IdentityServer.Application.Contracts\LINGYUN.Abp.IdentityServer.Application.Contracts.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.IdentityServer.Application.Contracts\LINGYUN.Abp.IdentityServer.Application.Contracts.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.IdentityServer.Domain\LINGYUN.Abp.IdentityServer.Domain.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.IdentityServer.Domain\LINGYUN.Abp.IdentityServer.Domain.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

46
aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.LinkUser/LINGYUN.Abp.IdentityServer.LinkUser.csproj

@ -1,23 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Remove="LINGYUN\Abp\IdentityServer\LinkUser\Localization\*.json" /> <None Remove="LINGYUN\Abp\IdentityServer\LinkUser\Localization\*.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="LINGYUN\Abp\IdentityServer\LinkUser\Localization\*.json" /> <EmbeddedResource Include="LINGYUN\Abp\IdentityServer\LinkUser\Localization\*.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.IdentityServer.Domain" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

30
aspnet-core/modules/localization/LINGYUN.Abp.Localization.CultureMap/LINGYUN.Abp.Localization.CultureMap.csproj

@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.AspNetCore" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
</Project> </Project>

38
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore.csproj

@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.LocalizationManagement.Domain\LINGYUN.Abp.LocalizationManagement.Domain.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.LocalizationManagement.Domain\LINGYUN.Abp.LocalizationManagement.Domain.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

32
aspnet-core/modules/lt/LINGYUN.Abp.LocalizationManagement.HttpApi/LINGYUN.Abp.LocalizationManagement.HttpApi.csproj

@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\localization\LINGYUN.Abp.AspNetCore.Mvc.Localization\LINGYUN.Abp.AspNetCore.Mvc.Localization.csproj" /> <ProjectReference Include="..\..\localization\LINGYUN.Abp.AspNetCore.Mvc.Localization\LINGYUN.Abp.AspNetCore.Mvc.Localization.csproj" />
<ProjectReference Include="..\LINGYUN.Abp.LocalizationManagement.Application.Contracts\LINGYUN.Abp.LocalizationManagement.Application.Contracts.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.LocalizationManagement.Application.Contracts\LINGYUN.Abp.LocalizationManagement.Application.Contracts.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

12
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Tencent/Properties/launchSettings.json

@ -0,0 +1,12 @@
{
"profiles": {
"LINGYUN.Abp.OssManagement.Tencent": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:58740;http://localhost:58741"
}
}
}

11
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobDownloadInput.cs

@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Platform.Packages;
public class PackageBlobDownloadInput
{
[Required]
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxNameLength))]
public string Name { get; set; }
}

21
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobDto.cs

@ -0,0 +1,21 @@
using System;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
namespace LINGYUN.Platform.Packages;
public class PackageBlobDto : CreationAuditedEntityDto<int>, IHasExtraProperties
{
public string Name { get; set; }
public string Url { get; set; }
public long? Size { get; set; }
public string Summary { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
public string License { get; set; }
public string Authors { get; set; }
public string SHA256 { get; set; }
public string ContentType { get; set; }
public int DownloadCount { get; set; }
public ExtraPropertyDictionary ExtraProperties { get; set; }
}

11
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobRemoveDto.cs

@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Platform.Packages;
public class PackageBlobRemoveDto
{
[Required]
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxNameLength))]
public string Name { get; set; }
}

36
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageBlobUploadDto.cs

@ -0,0 +1,36 @@
using System;
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Auditing;
using Volo.Abp.Content;
using Volo.Abp.Validation;
namespace LINGYUN.Platform.Packages;
public class PackageBlobUploadDto
{
[Required]
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxNameLength))]
public string Name { get; set; }
public long? Size { get; set; }
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxSummaryLength))]
public string Summary { get; set; }
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxContentTypeLength))]
public string ContentType { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime? UpdatedAt { get; set; }
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxLicenseLength))]
public string License { get; set; }
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxAuthorsLength))]
public string Authors { get; set; }
[Required]
[DisableAuditing]
public IRemoteStreamContent File { get; set; }
}

19
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageCreateDto.cs

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Platform.Packages;
public class PackageCreateDto : PackageCreateOrUpdateDto
{
/// <summary>
/// 名称
/// </summary>
[Required]
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxNameLength))]
public string Name { get; set; }
/// <summary>
/// 版本
/// </summary>
[Required]
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxVersionLength))]
public string Version { get; set; }
}

28
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageCreateOrUpdateDto.cs

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Platform.Packages;
public abstract class PackageCreateOrUpdateDto
{
/// <summary>
/// 版本说明
/// </summary>
[Required]
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxNoteLength))]
public string Note { get; set; }
/// <summary>
/// 描述
/// </summary>
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxDescriptionLength))]
public string Description { get; set; }
/// <summary>
/// 强制更新
/// </summary>
public bool ForceUpdate { get; set; }
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxAuthorsLength))]
public string Authors { get; set; }
public PackageLevel Level { get; set; }
}

46
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageDto.cs

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Domain.Entities;
namespace LINGYUN.Platform.Packages;
public class PackageDto : ExtensibleAuditedEntityDto<Guid>, IHasConcurrencyStamp
{
public string ConcurrencyStamp { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 版本说明
/// </summary>
public string Note { get; set; }
/// <summary>
/// 版本
/// </summary>
public string Version { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 强制更新
/// </summary>
public bool ForceUpdate { get; set; }
public string Authors { get; set; }
public PackageLevel Level { get; set; }
public List<PackageBlobDto> Blobs { get; set; } = new List<PackageBlobDto>();
public static PackageDto None()
{
return new PackageDto
{
Level = PackageLevel.None,
Blobs = new List<PackageBlobDto>()
};
}
}

11
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageGetLatestInput.cs

@ -0,0 +1,11 @@
using System.ComponentModel.DataAnnotations;
using Volo.Abp.Validation;
namespace LINGYUN.Platform.Packages;
public class PackageGetLatestInput
{
[Required]
[DynamicMaxLength(typeof(PackageBlobConsts), nameof(PackageBlobConsts.MaxNameLength))]
public string Name { get; set; }
}

26
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageGetPagedListInput.cs

@ -0,0 +1,26 @@
using Volo.Abp.Application.Dtos;
using Volo.Abp.Validation;
namespace LINGYUN.Platform.Packages;
public class PackageGetPagedListInput : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxNameLength))]
public string Name { get; set; }
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxNoteLength))]
public string Note { get; set; }
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxVersionLength))]
public string Version { get; set; }
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxDescriptionLength))]
public string Description { get; set; }
public bool? ForceUpdate { get; set; }
[DynamicMaxLength(typeof(PackageConsts), nameof(PackageConsts.MaxAuthorsLength))]
public string Authors { get; set; }
}

8
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/Dto/PackageUpdateDto.cs

@ -0,0 +1,8 @@
using Volo.Abp.Domain.Entities;
namespace LINGYUN.Platform.Packages;
public class PackageUpdateDto : PackageCreateOrUpdateDto, IHasConcurrencyStamp
{
public string ConcurrencyStamp { get; set; }
}

29
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Packages/IPackageAppService.cs

@ -0,0 +1,29 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.Content;
namespace LINGYUN.Platform.Packages;
public interface IPackageAppService :
ICrudAppService<
PackageDto,
Guid,
PackageGetPagedListInput,
PackageCreateDto,
PackageUpdateDto>
{
Task<PackageDto> GetLatestAsync(PackageGetLatestInput input);
Task<PackageBlobDto> UploadBlobAsync(
Guid id,
PackageBlobUploadDto input);
Task RemoveBlobAsync(
Guid id,
PackageBlobRemoveDto input);
Task<IRemoteStreamContent> DownloadBlobAsync(
Guid id,
PackageBlobDownloadInput input);
}

15
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs

@ -10,15 +10,6 @@ namespace LINGYUN.Platform.Permissions
{ {
var platform = context.AddGroup(PlatformPermissions.GroupName, L("Permission:Platform")); var platform = context.AddGroup(PlatformPermissions.GroupName, L("Permission:Platform"));
var appVersion = platform.AddPermission(PlatformPermissions.AppVersion.Default, L("Permission:AppVersion"));
appVersion.AddChild(PlatformPermissions.AppVersion.Create, L("Permission:CreateVersion"));
appVersion.AddChild(PlatformPermissions.AppVersion.Delete, L("Permission:DeleteVersion"));
var versionFile = appVersion.AddChild(PlatformPermissions.AppVersion.FileManager.Default, L("Permission:FileManager"));
versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Create, L("Permission:AppendFile"));
versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Delete, L("Permission:DeleteFile"));
versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Download, L("Permission:DownloadFile"));
var dataDictionary = platform.AddPermission(PlatformPermissions.DataDictionary.Default, L("Permission:DataDictionary")); var dataDictionary = platform.AddPermission(PlatformPermissions.DataDictionary.Default, L("Permission:DataDictionary"));
dataDictionary.AddChild(PlatformPermissions.DataDictionary.Create, L("Permission:Create")); dataDictionary.AddChild(PlatformPermissions.DataDictionary.Create, L("Permission:Create"));
dataDictionary.AddChild(PlatformPermissions.DataDictionary.Update, L("Permission:Update")); dataDictionary.AddChild(PlatformPermissions.DataDictionary.Update, L("Permission:Update"));
@ -38,6 +29,12 @@ namespace LINGYUN.Platform.Permissions
menu.AddChild(PlatformPermissions.Menu.ManageRoles, L("Permission:ManageRoleMenus")); menu.AddChild(PlatformPermissions.Menu.ManageRoles, L("Permission:ManageRoleMenus"));
menu.AddChild(PlatformPermissions.Menu.ManageUsers, L("Permission:ManageUserMenus")); menu.AddChild(PlatformPermissions.Menu.ManageUsers, L("Permission:ManageUserMenus"));
menu.AddChild(PlatformPermissions.Menu.ManageUserFavorites, L("Permission:ManageUserFavoriteMenus")); menu.AddChild(PlatformPermissions.Menu.ManageUserFavorites, L("Permission:ManageUserFavoriteMenus"));
var package = platform.AddPermission(PlatformPermissions.Package.Default, L("Permission:Package"));
package.AddChild(PlatformPermissions.Package.Create, L("Permission:Create"));
package.AddChild(PlatformPermissions.Package.Update, L("Permission:Update"));
package.AddChild(PlatformPermissions.Package.Delete, L("Permission:Delete"));
package.AddChild(PlatformPermissions.Package.ManageBlobs, L("Permission:ManageBlobs"));
} }
private static LocalizableString L(string name) private static LocalizableString L(string name)

15
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs

@ -85,24 +85,17 @@ namespace LINGYUN.Platform.Permissions
} }
} }
public class AppVersion public class Package
{ {
public const string Default = GroupName + ".AppVersion"; public const string Default = GroupName + ".Package";
public const string Create = Default + ".Create"; public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete"; public const string Delete = Default + ".Delete";
public class FileManager public const string Update = Default + ".Update";
{
public const string Default = AppVersion.Default + ".FileManager";
public const string Create = Default + ".Create";
public const string Delete = Default + ".Delete";
public const string Download = Default + ".Download"; public const string ManageBlobs = Default + ".ManageBlobs";
}
} }
public static string[] GetAll() public static string[] GetAll()

33
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionCreateDto.cs

@ -1,33 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Platform.Versions
{
public class VersionCreateDto
{
/// <summary>
/// 标题
/// </summary>
[Required]
[StringLength(AppVersionConsts.MaxTitleLength)]
public string Title { get; set; }
/// <summary>
/// 版本号
/// </summary>
[Required]
[StringLength(AppVersionConsts.MaxVersionLength)]
public string Version { get; set; }
/// <summary>
/// 描述
/// </summary>
[StringLength(AppVersionConsts.MaxDescriptionLength)]
public string Description { get; set; }
/// <summary>
/// 适应平台
/// </summary>
public PlatformType PlatformType { get; set; } = PlatformType.None;
/// <summary>
/// 重要级别
/// </summary>
public ImportantLevel Level { get; set; } = ImportantLevel.Low;
}
}

13
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDeleteDto.cs

@ -1,13 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Platform.Versions
{
public class VersionDeleteDto
{
[Required]
[StringLength(AppVersionConsts.MaxVersionLength)]
public string Version { get; set; }
public PlatformType PlatformType { get; set; }
}
}

34
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDto.cs

@ -1,34 +0,0 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Platform.Versions
{
public class VersionDto : EntityDto<Guid>
{
/// <summary>
/// 创建日期
/// </summary>
public DateTime CreationTime { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 重要级别
/// </summary>
public ImportantLevel Level { get; set; }
/// <summary>
/// 文件列表
/// </summary>
public List<VersionFileDto> Files { get; set; } = new List<VersionFileDto>();
}
}

51
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileCreateDto.cs

@ -1,51 +0,0 @@
using Newtonsoft.Json;
using System;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Platform.Versions
{
public class VersionFileCreateDto
{
[Required]
public Guid VersionId { get; set; }
[Required]
[StringLength(AppVersionConsts.MaxVersionLength)]
public string Version { get; set; }
/// <summary>
/// 文件路径
/// </summary>
[StringLength(VersionFileConsts.MaxPathLength)]
public string FilePath { get; set; }
/// <summary>
/// 文件名称
/// </summary>
[Required]
[StringLength(VersionFileConsts.MaxNameLength)]
public string FileName { get; set; }
/// <summary>
/// 文件版本
/// </summary>
[Required]
[StringLength(VersionFileConsts.MaxVersionLength)]
public string FileVersion { get; set; }
/// <summary>
/// 当前字节数
/// </summary>
[Required]
public int CurrentByte { get; set; }
/// <summary>
/// 最大字节数
/// </summary>
[Required]
public int TotalByte { get; set; }
/// <summary>
/// 文件类型
/// </summary>
public FileType FileType { get; set; }
/// <summary>
/// 文件指纹
/// </summary>
public string SHA256 { get; set; }
}
}

15
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDeleteDto.cs

@ -1,15 +0,0 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Platform.Versions
{
public class VersionFileDeleteDto
{
[Required]
public Guid VersionId { get; set; }
[Required]
[StringLength(VersionFileConsts.MaxNameLength)]
public string FileName { get; set; }
}
}

33
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDto.cs

@ -1,33 +0,0 @@
using Newtonsoft.Json;
namespace LINGYUN.Platform.Versions
{
public class VersionFileDto
{
/// <summary>
/// 文件路径
/// </summary>
public string Path { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 文件版本
/// </summary>
public string Version { get; set; }
/// <summary>
/// 文件SHA256编码
/// </summary>
public string SHA256 { get; set; }
/// <summary>
/// 文件大小
/// 单位b
/// </summary>
public long Size { get; set; }
/// <summary>
/// 文件类型
/// </summary>
public FileType FileType { get; set; }
}
}

24
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileGetDto.cs

@ -1,24 +0,0 @@
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Platform.Versions
{
public class VersionFileGetDto
{
public PlatformType PlatformType { get; set; } = PlatformType.None;
[Required]
[StringLength(AppVersionConsts.MaxVersionLength)]
public string Version { get; set; }
[StringLength(VersionFileConsts.MaxPathLength)]
public string FilePath { get; set; }
[Required]
[StringLength(VersionFileConsts.MaxNameLength)]
public string FileName { get; set; }
[Required]
[StringLength(VersionFileConsts.MaxVersionLength)]
public string FileVersion { get; set; }
}
}

9
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionGetByIdDto.cs

@ -1,9 +0,0 @@
using System;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Platform.Versions
{
public class VersionGetByIdDto : EntityDto<Guid>
{
}
}

10
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionGetByPagedDto.cs

@ -1,10 +0,0 @@
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Platform.Versions
{
public class VersionGetByPagedDto : PagedAndSortedResultRequestDto
{
public string Filter { get; set; }
public PlatformType PlatformType { get; set; } = PlatformType.None;
}
}

27
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/IVersionAppService.cs

@ -1,27 +0,0 @@
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace LINGYUN.Platform.Versions
{
public interface IVersionAppService : IApplicationService
{
Task<VersionDto> GetLastestAsync(PlatformType platformType);
Task<PagedResultDto<VersionDto>> GetAsync(VersionGetByPagedDto versionGetByPaged);
Task<VersionDto> GetAsync(VersionGetByIdDto versionGetById);
Task<VersionDto> CreateAsync(VersionCreateDto versionCreate);
Task DeleteAsync(VersionDeleteDto versionDelete);
Task AppendFileAsync(VersionFileCreateDto versionFileCreate);
Task RemoveFileAsync(VersionFileDeleteDto versionFileDelete);
Task RemoveAllFileAsync(VersionGetByIdDto versionGetById);
Task DownloadFileAsync(VersionFileGetDto versionFileGet);
}
}

187
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Packages/PackageAppService.cs

@ -0,0 +1,187 @@
using LINGYUN.Platform.Permissions;
using Microsoft.AspNetCore.Authorization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Content;
using Volo.Abp.Data;
namespace LINGYUN.Platform.Packages;
public class PackageAppService : PlatformApplicationServiceBase, IPackageAppService
{
private readonly IPackageBlobManager _blobManager;
private readonly IPackageRepository _packageRepository;
public PackageAppService(
IPackageBlobManager blobManager,
IPackageRepository packageRepository)
{
_blobManager = blobManager;
_packageRepository = packageRepository;
}
public async virtual Task<PackageDto> GetLatestAsync(PackageGetLatestInput input)
{
var package = await _packageRepository.FindLatestAsync(input.Name);
return package == null ? PackageDto.None() : ObjectMapper.Map<Package, PackageDto>(package);
}
[Authorize(PlatformPermissions.Package.Create)]
public async virtual Task<PackageDto> CreateAsync(PackageCreateDto input)
{
var package = await _packageRepository.FindLatestAsync(input.Name);
if (package != null)
{
if (string.Compare(input.Version, package.Version, StringComparison.CurrentCultureIgnoreCase) <= 0)
{
throw new BusinessException(PlatformErrorCodes.PackageVersionDegraded)
.WithData(nameof(Package.Name), input.Name)
.WithData(nameof(Package.Version), input.Version);
}
}
package = new Package(
GuidGenerator.Create(),
input.Name,
input.Note,
input.Version,
input.Description,
CurrentTenant.Id);
UpdateByInput(package, input);
package = await _packageRepository.InsertAsync(package);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<Package, PackageDto>(package);
}
[Authorize(PlatformPermissions.Package.Delete)]
public async virtual Task DeleteAsync(Guid id)
{
await _packageRepository.DeleteAsync(id);
await CurrentUnitOfWork.SaveChangesAsync();
}
[Authorize(PlatformPermissions.Package.ManageBlobs)]
public async virtual Task<PackageBlobDto> UploadBlobAsync(
Guid id,
PackageBlobUploadDto input)
{
var package = await _packageRepository.GetAsync(id);
var packageBlob = package.FindBlob(input.Name);
if (packageBlob == null)
{
packageBlob = package.CreateBlob(
input.Name,
input.CreatedAt,
input.UpdatedAt,
input.Size ?? input.File.ContentLength,
input.Summary);
await _blobManager.SaveBlobAsync(package, packageBlob, input.File.GetStream());
}
await _packageRepository.UpdateAsync(package);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<PackageBlob, PackageBlobDto>(packageBlob);
}
[Authorize(PlatformPermissions.Package.ManageBlobs)]
public async virtual Task RemoveBlobAsync(
Guid id,
PackageBlobRemoveDto input)
{
var package = await _packageRepository.GetAsync(id);
var packageBlob = package.FindBlob(input.Name);
await _blobManager.RemoveBlobAsync(package, packageBlob);
package.RemoveBlob(input.Name);
await CurrentUnitOfWork.SaveChangesAsync();
}
public async virtual Task<IRemoteStreamContent> DownloadBlobAsync(Guid id, PackageBlobDownloadInput input)
{
var package = await _packageRepository.GetAsync(id);
var packageBlob = package.FindBlob(input.Name);
var stream = await _blobManager.DownloadBlobAsync(package, packageBlob);
return new RemoteStreamContent(stream, packageBlob.Name, packageBlob.ContentType);
}
public async virtual Task<PackageDto> GetAsync(Guid id)
{
var package = await _packageRepository.GetAsync(id);
return ObjectMapper.Map<Package, PackageDto>(package);
}
[Authorize(PlatformPermissions.Package.Default)]
public async virtual Task<PagedResultDto<PackageDto>> GetListAsync(PackageGetPagedListInput input)
{
var filter = new PackageFilter(
input.Filter, input.Name, input.Note, input.Version,
input.Description, input.ForceUpdate, input.Authors);
var specification = new PackageSpecification(filter);
var totalCount = await _packageRepository.GetCountAsync(specification);
var entities = await _packageRepository.GetListAsync(specification);
return new PagedResultDto<PackageDto>(
totalCount,
ObjectMapper.Map<List<Package>, List<PackageDto>>(entities));
}
[Authorize(PlatformPermissions.Package.Update)]
public async virtual Task<PackageDto> UpdateAsync(Guid id, PackageUpdateDto input)
{
var package = await _packageRepository.GetAsync(id);
UpdateByInput(package, input);
package.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp);
package = await _packageRepository.UpdateAsync(package);
await CurrentUnitOfWork.SaveChangesAsync();
return ObjectMapper.Map<Package, PackageDto>(package);
}
protected virtual void UpdateByInput(Package entity, PackageCreateOrUpdateDto input)
{
if (!string.Equals(entity.Note, input.Note, StringComparison.CurrentCultureIgnoreCase))
{
entity.SetNote(input.Note);
}
if (!string.Equals(entity.Authors, input.Authors, StringComparison.CurrentCultureIgnoreCase))
{
entity.Authors = Check.Length(input.Authors, nameof(Package.Authors), PackageConsts.MaxAuthorsLength);
}
if (!string.Equals(entity.Description, input.Description, StringComparison.CurrentCultureIgnoreCase))
{
entity.Description = Check.Length(input.Description, nameof(Package.Description), PackageConsts.MaxDescriptionLength);
}
entity.ForceUpdate = input.ForceUpdate;
entity.Level = input.Level;
}
}

6
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs

@ -2,7 +2,7 @@
using LINGYUN.Platform.Datas; using LINGYUN.Platform.Datas;
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.Versions; using LINGYUN.Platform.Packages;
namespace LINGYUN.Platform namespace LINGYUN.Platform
{ {
@ -10,8 +10,8 @@ namespace LINGYUN.Platform
{ {
public PlatformApplicationMappingProfile() public PlatformApplicationMappingProfile()
{ {
CreateMap<VersionFile, VersionFileDto>(); CreateMap<PackageBlob, PackageBlobDto>();
CreateMap<AppVersion, VersionDto>(); CreateMap<Package, PackageDto>();
CreateMap<DataItem, DataItemDto>(); CreateMap<DataItem, DataItemDto>();
CreateMap<Data, DataDto>(); CreateMap<Data, DataDto>();

103
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Versions/VersionAppService.cs

@ -1,103 +0,0 @@
using LINGYUN.Platform.Permissions;
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Platform.Versions
{
[Authorize(PlatformPermissions.AppVersion.Default)]
public class VersionAppService : PlatformApplicationServiceBase, IVersionAppService
{
private readonly VersionManager _versionManager;
public VersionAppService(
VersionManager versionManager)
{
_versionManager = versionManager;
}
[Authorize(PlatformPermissions.AppVersion.FileManager.Create)]
public async virtual Task AppendFileAsync(VersionFileCreateDto versionFileCreate)
{
await _versionManager.AppendFileAsync(versionFileCreate.VersionId,
versionFileCreate.SHA256, versionFileCreate.FileName, versionFileCreate.FileVersion,
versionFileCreate.TotalByte, versionFileCreate.FilePath, versionFileCreate.FileType);
}
[Authorize(PlatformPermissions.AppVersion.Create)]
public async virtual Task<VersionDto> CreateAsync(VersionCreateDto versionCreate)
{
if (await _versionManager.ExistsAsync(versionCreate.PlatformType,versionCreate.Version))
{
throw new UserFriendlyException("VersionAlreadyExists");
}
var version = new AppVersion(GuidGenerator.Create(), versionCreate.Title,
versionCreate.Version, versionCreate.PlatformType, CurrentTenant.Id)
{
Description = versionCreate.Description,
Level = versionCreate.Level
};
await _versionManager.CreateAsync(version);
return ObjectMapper.Map<AppVersion, VersionDto>(version);
}
[Authorize(PlatformPermissions.AppVersion.Delete)]
public async virtual Task DeleteAsync(VersionDeleteDto versionDelete)
{
var version = await _versionManager.GetByVersionAsync(versionDelete.PlatformType, versionDelete.Version);
if (version != null)
{
await _versionManager.DeleteAsync(version.Id);
}
}
public async virtual Task<PagedResultDto<VersionDto>> GetAsync(VersionGetByPagedDto versionGetByPaged)
{
var versionCount = await _versionManager.GetCountAsync(versionGetByPaged.PlatformType, versionGetByPaged.Filter);
var versions = await _versionManager.GetPagedListAsync(versionGetByPaged.PlatformType, versionGetByPaged.Filter,
versionGetByPaged.Sorting, true,
versionGetByPaged.SkipCount, versionGetByPaged.MaxResultCount);
return new PagedResultDto<VersionDto>(versionCount,
ObjectMapper.Map<List<AppVersion>, List<VersionDto>>(versions));
}
public async virtual Task<VersionDto> GetAsync(VersionGetByIdDto versionGetById)
{
var version = await _versionManager.GetByIdAsync(versionGetById.Id);
return ObjectMapper.Map<AppVersion, VersionDto>(version);
}
public async virtual Task<VersionDto> GetLastestAsync(PlatformType platformType)
{
var version = await _versionManager.GetLatestAsync(platformType);
return ObjectMapper.Map<AppVersion, VersionDto>(version);
}
[Authorize(PlatformPermissions.AppVersion.FileManager.Delete)]
public async virtual Task RemoveAllFileAsync(VersionGetByIdDto versionGetById)
{
await _versionManager.RemoveAllFileAsync(versionGetById.Id);
}
[Authorize(PlatformPermissions.AppVersion.FileManager.Delete)]
public async virtual Task RemoveFileAsync(VersionFileDeleteDto versionFileDelete)
{
await _versionManager.RemoveFileAsync(versionFileDelete.VersionId, versionFileDelete.FileName);
}
public virtual Task DownloadFileAsync(VersionFileGetDto versionFileGet)
{
// TODO: 是否需要定义此接口用于 abp-definition-api ?
// overrided implement HttpContext.Response.Body.Write(Stream fileStream)
return Task.CompletedTask;
}
}
}

1
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json

@ -1,6 +1,7 @@
{ {
"culture": "en", "culture": "en",
"texts": { "texts": {
"Platform:01403": "Package {Name} Version {Version} cannot be degraded!",
"Platform:01404": "File not found, name: {FileName}, version:{FileVersion}!", "Platform:01404": "File not found, name: {FileName}, version:{FileVersion}!",
"Platform:02001": "The same menu exists in the sibling directory: {Name}!", "Platform:02001": "The same menu exists in the sibling directory: {Name}!",
"Platform:02002": "You are not allowed to delete menu nodes when there are other submenus!", "Platform:02002": "You are not allowed to delete menu nodes when there are other submenus!",

1
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json

@ -1,6 +1,7 @@
{ {
"culture": "zh-Hans", "culture": "zh-Hans",
"texts": { "texts": {
"Platform:01403": "包 {Name} 版本 {Version} 不能降级!",
"Platform:01404": "文件: {FileName}, 版本号: {FileVersion} 不存在!", "Platform:01404": "文件: {FileName}, 版本号: {FileVersion} 不存在!",
"Platform:02001": "同级目录下存在相同的菜单: {Name}!", "Platform:02001": "同级目录下存在相同的菜单: {Name}!",
"Platform:02002": "在有其他子菜单的情况下,不允许删除菜单节点!", "Platform:02002": "在有其他子菜单的情况下,不允许删除菜单节点!",

2
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatformModuleExtensionConsts.cs

@ -8,7 +8,7 @@
{ {
public const string Route = "Route"; public const string Route = "Route";
public const string AppVersion = "AppVersion"; public const string Package = "Package";
} }
} }
} }

4
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatfromModuleExtensionConfiguration.cs

@ -14,11 +14,11 @@ namespace LINGYUN.Platform.ObjectExtending
); );
} }
public PlatfromModuleExtensionConfiguration ConfigureAppVersion( public PlatfromModuleExtensionConfiguration ConfigurePackage(
Action<EntityExtensionConfiguration> configureAction) Action<EntityExtensionConfiguration> configureAction)
{ {
return this.ConfigureEntity( return this.ConfigureEntity(
PlatformModuleExtensionConsts.EntityNames.AppVersion, PlatformModuleExtensionConsts.EntityNames.Package,
configureAction configureAction
); );
} }

11
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageBlobConsts.cs

@ -0,0 +1,11 @@
namespace LINGYUN.Platform.Packages;
public static class PackageBlobConsts
{
public static int MaxNameLength { get; set; } = 255;
public static int MaxUrlLength { get; set; } = 512;
public static int MaxContentTypeLength { get; set; } = 256;
public static int MaxSummaryLength { get; set; } = 1024;
public static int MaxLicenseLength { get; set; } = 1024;
public static int MaxAuthorsLength { get; set; } = 100;
public static int MaxSHA256Length { get; set; } = 256;
}

10
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageConsts.cs

@ -0,0 +1,10 @@
namespace LINGYUN.Platform.Packages;
public static class PackageConsts
{
public static int MaxNameLength { get; set; } = 255;
public static int MaxNoteLength { get; set; } = 1024;
public static int MaxVersionLength { get; set; } = 30;
public static int MaxDescriptionLength { get; set; } = 255;
public static int MaxPlatformLength { get; set; } = 20;
public static int MaxAuthorsLength { get; set; } = 100;
}

24
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageEto.cs

@ -0,0 +1,24 @@
using System;
using Volo.Abp.EventBus;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Packages;
[EventName("platform.packages")]
public class PackageEto : IMultiTenant
{
public Guid? TenantId { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 版本
/// </summary>
public string Version { get; set; }
/// <summary>
/// 强制更新
/// </summary>
public bool ForceUpdate { get; set; }
public PackageLevel Level { get; set; }
}

17
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Packages/PackageLevel.cs

@ -0,0 +1,17 @@
namespace LINGYUN.Platform.Packages;
public enum PackageLevel
{
/// <summary>
/// 无需更新
/// </summary>
None = -1,
/// <summary>
/// 资源
/// </summary>
Resource = 0,
/// <summary>
/// 整体
/// </summary>
Full = 1
}

4
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs

@ -5,6 +5,10 @@
private const string Namespace = "Platform"; private const string Namespace = "Platform";
public const string VersionFileNotFound = Namespace + ":01404"; public const string VersionFileNotFound = Namespace + ":01404";
/// <summary>
/// 包版本不能降级
/// </summary>
public const string PackageVersionDegraded = Namespace + ":01403";
/// <summary> /// <summary>
/// 同级菜单已经存在 /// 同级菜单已经存在
/// </summary> /// </summary>

14
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/AppVersionConsts.cs

@ -1,14 +0,0 @@
namespace LINGYUN.Platform.Versions
{
public static class AppVersionConsts
{
public const int MaxTitleLength = 50;
public const int MaxVersionLength = 20;
public const int MaxDescriptionLength = 2048;
public const int DefaultVersionFileLimitLength = 200;
public const string DefaultAllowVersionFileExtensions = "dll,zip,rar,txt,log,xml,config,json,jpeg,jpg,png,bmp,ico,xlsx,xltx,xls,xlt,docs,dots,doc,dot,pptx,potx,ppt,pot,chm";
}
}

33
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/AppVersionEto.cs

@ -1,33 +0,0 @@
using System;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Versions
{
public class AppVersionEto : IMultiTenant
{
/// <summary>
/// 租户标识
/// </summary>
public Guid? TenantId { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 版本号
/// </summary>
public string Version { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 重要级别
/// </summary>
public ImportantLevel Level { get; set; }
/// <summary>
/// 文件数量
/// </summary>
public int FileCount { get; set; }
}
}

21
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/FileType.cs

@ -1,21 +0,0 @@
namespace LINGYUN.Platform.Versions
{
/// <summary>
/// 文件类型
/// </summary>
public enum FileType
{
/// <summary>
/// 普通文件流
/// </summary>
Stream = 0,
/// <summary>
/// 压缩文件
/// </summary>
Zip = 1,
/// <summary>
/// 脚本文件
/// </summary>
Scripts = 2
}
}

11
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/IVersionFileManager.cs

@ -1,11 +0,0 @@
using System.IO;
using System.Threading.Tasks;
namespace LINGYUN.Platform.Versions
{
public interface IVersionFileManager
{
Task<string> SaveFileAsync(string version, string filePath, string fileName, string fileVersion, byte[] data);
Task<Stream> DownloadFileAsync(PlatformType platformType, string version, string filePath, string fileName, string fileVersion);
}
}

22
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/ImportantLevel.cs

@ -1,22 +0,0 @@
namespace LINGYUN.Platform.Versions
{
public enum ImportantLevel
{
/// <summary>
/// 未定义
/// </summary>
None = -1,
/// <summary>
/// 低
/// </summary>
Low = 0,
/// <summary>
/// 高
/// </summary>
High = 1,
/// <summary>
/// 重要
/// </summary>
Matter
}
}

13
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/VersionFileConsts.cs

@ -1,13 +0,0 @@
namespace LINGYUN.Platform.Versions
{
public static class VersionFileConsts
{
public const int MaxNameLength = 255;
public const int MaxPathLength = 255;
public const int MaxVersionLength = 20;
public const int MaxSHA256Length = 65;
}
}

20
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/FileSystemPackageBlobNormalizer.cs

@ -0,0 +1,20 @@
using System.IO;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Platform.Packages;
public class FileSystemPackageBlobNormalizer : IPackageBlobNormalizer, ISingletonDependency
{
public FileSystemPackageBlobNormalizer()
{
}
public string Normalize(Package package, PackageBlob blob)
{
var pk = package.Name;
var pv = package.Version;
return Path.Combine(pk, "v" + pv, "blobs", blob.Name);
}
}

25
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/IPackageBlobManager.cs

@ -0,0 +1,25 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace LINGYUN.Platform.Packages;
public interface IPackageBlobManager
{
Task RemoveBlobAsync(
Package package,
PackageBlob packageBlob,
CancellationToken cancellationToken = default);
Task SaveBlobAsync(
Package package,
PackageBlob packageBlob,
Stream stream,
bool overrideExisting = true,
CancellationToken cancellationToken = default);
Task<Stream> DownloadBlobAsync(
Package package,
PackageBlob packageBlob,
CancellationToken cancellationToken = default);
}

6
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/IPackageBlobNormalizer.cs

@ -0,0 +1,6 @@
namespace LINGYUN.Platform.Packages;
public interface IPackageBlobNormalizer
{
string Normalize(Package package, PackageBlob blob);
}

32
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/IPackageRepository.cs

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Specifications;
namespace LINGYUN.Platform.Packages;
public interface IPackageRepository : IBasicRepository<Package, Guid>
{
Task<Package> FindByNameAsync(
string name,
bool includeDetails = true,
CancellationToken cancellationToken = default);
Task<Package> FindLatestAsync(
string name,
bool includeDetails = true,
CancellationToken cancellationToken = default);
Task<int> GetCountAsync(
Specification<Package> specification,
CancellationToken cancellationToken = default);
Task<List<Package>> GetListAsync(
Specification<Package> specification,
string sorting = $"{nameof(Package.Version)} DESC",
int skipCount = 0,
int maxResultCount = 10,
CancellationToken cancellationToken = default);
}

114
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/Package.cs

@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection.Emit;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Packages;
public class Package : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
/// <summary>
/// 名称
/// </summary>
public virtual string Name { get; protected set; }
/// <summary>
/// 版本说明
/// </summary>
public virtual string Note { get; protected set; }
/// <summary>
/// 版本
/// </summary>
public virtual string Version { get; protected set; }
/// <summary>
/// 描述
/// </summary>
public virtual string Description { get; set; }
/// <summary>
/// 强制更新
/// </summary>
public virtual bool ForceUpdate { get; set; }
public virtual string Authors { get; set; }
public virtual PackageLevel Level { get; set; }
public virtual ICollection<PackageBlob> Blobs { get; protected set; }
protected Package()
{
Blobs = new Collection<PackageBlob>();
ExtraProperties = new ExtraPropertyDictionary();
this.SetDefaultsForExtraProperties();
}
public Package(
Guid id,
string name,
string note,
string version,
string description = null,
Guid? tenantId = null)
: base(id)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name), PackageConsts.MaxNameLength);
Note = Check.NotNullOrWhiteSpace(note, nameof(note), PackageConsts.MaxNoteLength);
Version = Check.NotNullOrWhiteSpace(version, nameof(version), PackageConsts.MaxVersionLength);
Description = Check.Length(description, nameof(description), PackageConsts.MaxDescriptionLength);
TenantId = tenantId;
Level = PackageLevel.None;
Blobs = new Collection<PackageBlob>();
ExtraProperties = new ExtraPropertyDictionary();
this.SetDefaultsForExtraProperties();
}
public void SetNote(string note)
{
Note = Check.NotNullOrWhiteSpace(note, nameof(note), PackageConsts.MaxNoteLength);
}
public PackageBlob CreateBlob(
string name,
DateTime createdAt,
DateTime? updatedAt = null,
long? size = null,
string summary = null)
{
var findBlob = FindBlob(name);
if (findBlob == null)
{
findBlob = new PackageBlob(
Id,
name,
createdAt,
updatedAt,
size,
summary,
TenantId);
Blobs.Add(findBlob);
}
return findBlob;
}
public PackageBlob FindBlob(string name)
{
return Blobs.FirstOrDefault(x => x.Name == name);
}
public void RemoveBlob(string name)
{
Blobs.RemoveAll(x => x.Name == name);
}
public void ClearBlob()
{
Blobs.Clear();
}
}

64
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageBlob.cs

@ -0,0 +1,64 @@
using System;
using Volo.Abp;
using Volo.Abp.Data;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Packages;
public class PackageBlob : CreationAuditedEntity<int>, IMultiTenant, IHasExtraProperties
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid PackageId { get; private set; }
public virtual Package Package { get; private set; }
public virtual string Name { get; protected set; }
public virtual string Url { get; protected set; }
public virtual long? Size { get; protected set; }
public virtual string Summary { get; protected set; }
public virtual DateTime CreatedAt { get; protected set; }
public virtual DateTime? UpdatedAt { get; protected set; }
public virtual string License { get; set; }
public virtual string Authors { get; set; }
public virtual string ContentType { get; set; }
public virtual string SHA256 { get; set; }
public virtual int DownloadCount { get; protected set; }
public virtual ExtraPropertyDictionary ExtraProperties { get; set; }
protected PackageBlob()
{
ExtraProperties = new ExtraPropertyDictionary();
this.SetDefaultsForExtraProperties();
}
internal PackageBlob(
Guid packageId,
string name,
DateTime createdAt,
DateTime? updatedAt = null,
long? size = null,
string summary = null,
Guid? tenantId = null)
{
PackageId = packageId;
Name = Check.NotNullOrWhiteSpace(name, nameof(name), PackageBlobConsts.MaxNameLength);
CreatedAt = createdAt;
UpdatedAt = updatedAt;
Size = size;
Summary = Check.Length(summary, nameof(summary), PackageBlobConsts.MaxSummaryLength);
TenantId = tenantId;
DownloadCount = 0;
ExtraProperties = new ExtraPropertyDictionary();
this.SetDefaultsForExtraProperties();
}
public void SetUrl(string url)
{
Url = Check.NotNullOrWhiteSpace(url, nameof(url), PackageBlobConsts.MaxUrlLength);
}
public void Download()
{
DownloadCount += 1;
}
}

94
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageBlobManager.cs

@ -0,0 +1,94 @@
using System;
using System.IO;
using System.Security.Cryptography;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Services;
namespace LINGYUN.Platform.Packages;
[Dependency(TryRegister = true)]
public class PackageBlobManager : DomainService, IPackageBlobManager, ITransientDependency
{
protected IPackageBlobNormalizer BlobNormalizer { get; }
protected IBlobContainer<PackageContainer> PackageContainer { get; }
public PackageBlobManager(
IPackageBlobNormalizer blobNormalizer,
IBlobContainer<PackageContainer> packageContainer)
{
BlobNormalizer = blobNormalizer;
PackageContainer = packageContainer;
}
public async virtual Task RemoveBlobAsync(
Package package,
PackageBlob packageBlob,
CancellationToken cancellationToken = default)
{
var blobName = BlobNormalizer.Normalize(package, packageBlob);
await RemoveBlobAsync(blobName);
}
public async virtual Task<Stream> DownloadBlobAsync(
Package package,
PackageBlob packageBlob,
CancellationToken cancellationToken = default)
{
packageBlob.Download();
return await DownloadFromBlobAsync(package, packageBlob);
}
public async virtual Task SaveBlobAsync(
Package package,
PackageBlob packageBlob,
Stream stream,
bool overrideExisting = true,
CancellationToken cancellationToken = default)
{
var blobName = BlobNormalizer.Normalize(package, packageBlob);
await SaveToBlobAsync(blobName, stream, overrideExisting, cancellationToken);
stream.Seek(0, SeekOrigin.Begin);
packageBlob.SHA256 = ComputeHash(stream);
packageBlob.SetUrl($"api/platform/packages/{packageBlob.PackageId}/blob/{packageBlob.Name}");
}
protected async virtual Task<Stream> DownloadFromBlobAsync(
Package package,
PackageBlob packageBlob,
CancellationToken cancellationToken = default)
{
var blobName = BlobNormalizer.Normalize(package, packageBlob);
return await PackageContainer.GetAsync(blobName);
}
protected async virtual Task SaveToBlobAsync(
string blobName,
Stream stream,
bool overrideExisting = true,
CancellationToken cancellationToken = default)
{
await PackageContainer.SaveAsync(blobName, stream, overrideExisting, cancellationToken);
}
protected async virtual Task RemoveBlobAsync(
string blobName,
CancellationToken cancellationToken = default)
{
await PackageContainer.DeleteAsync(blobName, cancellationToken);
}
protected virtual string ComputeHash(Stream stream)
{
using var sha256 = SHA256.Create();
var checkHash = sha256.ComputeHash(stream);
return BitConverter.ToString(checkHash).Replace("-", string.Empty);
}
}

8
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageContainer.cs

@ -0,0 +1,8 @@
using Volo.Abp.BlobStoring;
namespace LINGYUN.Platform.Packages;
[BlobContainerName("packages")]
public class PackageContainer
{
}

36
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageFilter.cs

@ -0,0 +1,36 @@
namespace LINGYUN.Platform.Packages;
public class PackageFilter
{
public string Filter { get; set; }
public string Name { get; set; }
public string Note { get; set; }
public string Version { get; set; }
public string Description { get; set; }
public bool? ForceUpdate { get; set; }
public string Authors { get; set; }
public PackageFilter(
string filter = null,
string name = null,
string note = null,
string version = null,
string description = null,
bool? forceUpdate = null,
string authors = null)
{
Filter = filter;
Name = name;
Note = note;
Version = version;
Description = description;
ForceUpdate = forceUpdate;
Authors = authors;
}
}

31
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Packages/PackageSpecification.cs

@ -0,0 +1,31 @@
using System;
using System.Linq.Expressions;
using Volo.Abp.Specifications;
namespace LINGYUN.Platform.Packages;
public class PackageSpecification : Specification<Package>
{
protected PackageFilter Filter { get; }
public PackageSpecification(PackageFilter filter)
{
Filter = filter;
}
public override Expression<Func<Package, bool>> ToExpression()
{
Expression<Func<Package, bool>> expression = (p) => true;
return expression
.AndIf(!Filter.Name.IsNullOrWhiteSpace(), x => x.Name == Filter.Name)
.AndIf(!Filter.Note.IsNullOrWhiteSpace(), x => x.Note == Filter.Note)
.AndIf(!Filter.Version.IsNullOrWhiteSpace(), x => x.Version == Filter.Version)
.AndIf(!Filter.Description.IsNullOrWhiteSpace(), x => x.Description == Filter.Description)
.AndIf(!Filter.Authors.IsNullOrWhiteSpace(), x => x.Authors == Filter.Authors)
.AndIf(Filter.ForceUpdate.HasValue, x => x.ForceUpdate == Filter.ForceUpdate)
.AndIf(!Filter.Filter.IsNullOrWhiteSpace(), x => x.Name.Contains(Filter.Filter) ||
x.Note.Contains(Filter.Filter) || x.Version.Contains(Filter.Filter) ||
x.Description.Contains(Filter.Filter) || x.Authors.Contains(Filter.Filter));
}
}

6
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs

@ -1,8 +1,7 @@
using AutoMapper; using AutoMapper;
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.Routes; using LINGYUN.Platform.Packages;
using LINGYUN.Platform.Versions;
namespace LINGYUN.Platform namespace LINGYUN.Platform
{ {
@ -16,8 +15,7 @@ namespace LINGYUN.Platform
CreateMap<UserMenu, UserMenuEto>(); CreateMap<UserMenu, UserMenuEto>();
CreateMap<RoleMenu, RoleMenuEto>(); CreateMap<RoleMenu, RoleMenuEto>();
CreateMap<AppVersion, AppVersionEto>() CreateMap<Package, PackageEto>();
.ForMember(eto => eto.FileCount, map => map.MapFrom(src => src.Files.Count));
} }
} }
} }

14
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs

@ -2,8 +2,8 @@
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.ObjectExtending; using LINGYUN.Platform.ObjectExtending;
using LINGYUN.Platform.Packages;
using LINGYUN.Platform.Routes; using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper; using Volo.Abp.AutoMapper;
using Volo.Abp.BlobStoring; using Volo.Abp.BlobStoring;
@ -36,7 +36,7 @@ namespace LINGYUN.Platform
Configure<AbpBlobStoringOptions>(options => Configure<AbpBlobStoringOptions>(options =>
{ {
options.Containers.Configure<VersionContainer>(containerConfiguration => options.Containers.Configure<PackageContainer>(containerConfiguration =>
{ {
containerConfiguration.IsMultiTenant = true; containerConfiguration.IsMultiTenant = true;
}); });
@ -48,9 +48,9 @@ namespace LINGYUN.Platform
options.EtoMappings.Add<Menu, MenuEto>(typeof(PlatformDomainModule)); options.EtoMappings.Add<Menu, MenuEto>(typeof(PlatformDomainModule));
options.EtoMappings.Add<UserMenu, UserMenuEto>(typeof(PlatformDomainModule)); options.EtoMappings.Add<UserMenu, UserMenuEto>(typeof(PlatformDomainModule));
options.EtoMappings.Add<RoleMenu, RoleMenuEto>(typeof(PlatformDomainModule)); options.EtoMappings.Add<RoleMenu, RoleMenuEto>(typeof(PlatformDomainModule));
options.EtoMappings.Add<AppVersion, AppVersionEto>(typeof(PlatformDomainModule)); options.EtoMappings.Add<Package, PackageEto>(typeof(PlatformDomainModule));
}); });
} }
public override void PostConfigureServices(ServiceConfigurationContext context) public override void PostConfigureServices(ServiceConfigurationContext context)
@ -62,8 +62,8 @@ namespace LINGYUN.Platform
); );
ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity( ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity(
PlatformModuleExtensionConsts.ModuleName, PlatformModuleExtensionConsts.ModuleName,
PlatformModuleExtensionConsts.EntityNames.AppVersion, PlatformModuleExtensionConsts.EntityNames.Package,
typeof(AppVersion) typeof(Package)
); );
} }
} }

31
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Settings/PlatformSettingDefinitionProvider.cs

@ -1,5 +1,4 @@
using LINGYUN.Platform.Localization; using LINGYUN.Platform.Localization;
using LINGYUN.Platform.Versions;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Settings; using Volo.Abp.Settings;
@ -9,36 +8,12 @@ namespace LINGYUN.Platform.Settings
{ {
public override void Define(ISettingDefinitionContext context) public override void Define(ISettingDefinitionContext context)
{ {
context.Add(CreateAppVersionSettings()); context.Add(CreateDefaultSettings());
} }
protected SettingDefinition[] CreateAppVersionSettings() protected SettingDefinition[] CreateDefaultSettings()
{ {
return new SettingDefinition[] return new SettingDefinition[0];
{
new SettingDefinition(
name: PlatformSettingNames.AppVersion.VersionFileLimitLength,
defaultValue: AppVersionConsts.DefaultVersionFileLimitLength.ToString(),
displayName: L("DisplayName:VersionFileLimitLength"),
description: L("Description:VersionFileLimitLength"),
isVisibleToClients: true)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
ConfigurationSettingValueProvider.ProviderName,
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
new SettingDefinition(
name: PlatformSettingNames.AppVersion.AllowVersionFileExtensions,
defaultValue: AppVersionConsts.DefaultAllowVersionFileExtensions,
displayName: L("DisplayName:AllowVersionFileExtensions"),
description: L("Description:AllowVersionFileExtensions"),
isVisibleToClients: true)
.WithProviders(
DefaultValueSettingValueProvider.ProviderName,
ConfigurationSettingValueProvider.ProviderName,
GlobalSettingValueProvider.ProviderName,
TenantSettingValueProvider.ProviderName),
};
} }
protected LocalizableString L(string name) protected LocalizableString L(string name)

116
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/AppVersion.cs

@ -1,116 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Versions
{
/// <summary>
/// 应用版本号
/// </summary>
public class AppVersion : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
/// <summary>
/// 租户标识
/// </summary>
public virtual Guid? TenantId { get; protected set; }
/// <summary>
/// 标题
/// </summary>
public virtual string Title { get; protected set; }
/// <summary>
/// 版本号
/// </summary>
public virtual string Version { get; protected set; }
/// <summary>
/// 描述
/// </summary>
public virtual string Description { get; set; }
/// <summary>
/// 重要级别
/// </summary>
public virtual ImportantLevel Level { get; set; }
/// <summary>
/// 适应平台
/// </summary>
public virtual PlatformType PlatformType { get; protected set; }
/// <summary>
/// 版本文件列表
/// </summary>
public virtual ICollection<VersionFile> Files { get; protected set; }
protected AppVersion()
{
Files = new List<VersionFile>();
}
public AppVersion(Guid id, string title, string version, PlatformType platformType = PlatformType.None, Guid? tenantId = null)
{
Id = id;
Title = title;
Version = version;
TenantId = tenantId;
PlatformType = platformType;
Level = ImportantLevel.Low;
}
public void AppendFile(string name, string version, long size, string sha256,
string filePath = "", FileType fileType = FileType.Stream)
{
if (!FileExists(name))
{
var versionFile = new VersionFile(name, version, size, sha256, fileType, TenantId)
{
Path = filePath
};
Files.Add(versionFile);
}
}
public void RemoveFile(string name)
{
Files.RemoveAll(x => x.Name.Equals(name));
}
public void RemoveAllFile()
{
Files.Clear();
}
public void ChangeFileVersion(string name, string version, long size, string sha256)
{
if (FileExists(name))
{
var file = FindFile(name);
file.ChangeVersion(version, size, sha256);
}
}
public VersionFile FindFile(string name)
{
return Files.Where(x => x.Name.Equals(name)).FirstOrDefault();
}
public VersionFile FindFile(string path, string name)
{
return Files.Where(x => x.Path.Equals(path) && x.Name.Equals(name)).FirstOrDefault();
}
public VersionFile FindFile(string path, string name, string version)
{
return Files.Where(x => x.Path.Equals(path) && x.Name.Equals(name) && x.Version.Equals(version))
.FirstOrDefault();
}
public bool FileExists(string name)
{
// TODO: Windows file system ?
//if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
//{
// return Files.Any(x => x.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase));
//}
return Files.Any(x => x.Name.Equals(name));
}
}
}

21
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/IVersionRepository.cs

@ -1,21 +0,0 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace LINGYUN.Platform.Versions
{
public interface IVersionRepository : IBasicRepository<AppVersion, Guid>
{
Task<bool> ExistsAsync(PlatformType platformType, string version, CancellationToken cancellationToken = default);
Task<AppVersion> GetByVersionAsync(PlatformType platformType, string version, CancellationToken cancellationToken = default);
Task<long> GetCountAsync(PlatformType platformType, string filter = "", CancellationToken cancellationToken = default);
Task<List<AppVersion>> GetPagedListAsync(PlatformType platformType, string filter = "", string soring = nameof(AppVersion.CreationTime), bool includeDetails = true, int skipCount = 1, int maxResultCount = 10, CancellationToken cancellationToken = default);
Task<AppVersion> GetLatestVersionAsync(PlatformType platformType, CancellationToken cancellationToken = default);
}
}

9
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionContainer.cs

@ -1,9 +0,0 @@
using Volo.Abp.BlobStoring;
namespace LINGYUN.Platform.Versions
{
[BlobContainerName("app-platform-version")]
public class VersionContainer
{
}
}

102
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionFile.cs

@ -1,102 +0,0 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.IO;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Versions
{
public class VersionFile : AuditedEntity<int>, IMultiTenant
{
/// <summary>
/// 租户标识
/// </summary>
public virtual Guid? TenantId { get; protected set; }
/// <summary>
/// 文件路径
/// </summary>
public virtual string Path { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public virtual string Name { get; protected set; }
/// <summary>
/// 文件版本
/// </summary>
public virtual string Version { get; protected set; }
/// <summary>
/// 文件大小
/// 单位b
/// </summary>
public virtual long Size { get; protected set; }
/// <summary>
/// 文件类型
/// </summary>
public virtual FileType FileType { get; protected set; }
/// <summary>
/// 文件SHA256编码
/// </summary>
public virtual string SHA256 { get; protected set; }
/// <summary>
/// 下载次数
/// </summary>
public virtual int DownloadCount { get; protected set; }
/// <summary>
/// 应用版本标识
/// </summary>
public virtual Guid AppVersionId { get; protected set; }
/// <summary>
/// 所属应用版本号
/// </summary>
public virtual AppVersion AppVersion { get; protected set; }
protected VersionFile()
{
}
public VersionFile(string name, string version, long size, string sha256, FileType fileType = FileType.Stream, Guid? tenantId = null)
{
Name = name;
FileType = fileType;
TenantId = tenantId;
ChangeVersion(version, size, sha256);
}
public void ChangeVersion(string version, long size, string sha256)
{
Size = size;
SHA256 = sha256;
Version = version;
}
public void Download()
{
DownloadCount += 1;
}
public static string NormalizeBlobName(string appVersion, string fileName, string fileVersion,
string filePath = "")
{
var fileNameWithNotExten = fileName;
// 取出文件扩展名
var fileExten = FileHelper.GetExtension(fileName);
if (!fileExten.IsNullOrWhiteSpace())
{
// 取出不带扩展名的文件名
fileNameWithNotExten = fileName.Replace(fileExten, "");
// 去掉最后一位扩展名符号
fileNameWithNotExten = fileNameWithNotExten.Remove(fileNameWithNotExten.Length - 1);
}
// 转换不受支持的符号
fileNameWithNotExten = fileNameWithNotExten.Replace(".", "-");
//路径存储模式 如果传递了绝对路径,需要计算短路径
if (!filePath.IsNullOrWhiteSpace())
{
return $"{appVersion}/{filePath.Md5()}/{fileNameWithNotExten}/{fileVersion}/{fileName}";
}
// 最终文件名为 应用版本号/文件名(不带扩展名)/文件版本/文件名
// 例: 1.0.0.0/test-upload-text-file/1.0.0.0/test-upload-text-file.text
return $"{appVersion}/{fileNameWithNotExten}/{fileVersion}/{fileName}";
}
}
}

153
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionManager.cs

@ -1,153 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Services;
using Volo.Abp.Uow;
namespace LINGYUN.Platform.Versions
{
[Dependency(Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient)]
[ExposeServices(typeof(IVersionFileManager), typeof(VersionManager))]
public class VersionManager : DomainService, IVersionFileManager
{
protected IVersionRepository VersionRepository { get; }
protected IBlobContainer<VersionContainer> VersionBlobContainer { get; }
public VersionManager(
IBlobContainer<VersionContainer> container,
IVersionRepository versionRepository)
{
VersionBlobContainer = container;
VersionRepository = versionRepository;
}
public async virtual Task<bool> ExistsAsync(PlatformType platformType, string version)
{
return await VersionRepository.ExistsAsync(platformType, version);
}
public async virtual Task<AppVersion> GetByIdAsync(Guid id)
{
return await VersionRepository.GetAsync(id);
}
public async virtual Task<AppVersion> GetByVersionAsync(PlatformType platformType, string version)
{
return await VersionRepository.GetByVersionAsync(platformType, version);
}
public async virtual Task<long> GetCountAsync(PlatformType platformType, string filter)
{
return await VersionRepository.GetCountAsync(platformType, filter);
}
public async virtual Task<List<AppVersion>> GetPagedListAsync(PlatformType platformType, string filter = "", string soring = nameof(AppVersion.CreationTime), bool includeDetails = true, int skipCount = 1, int maxResultCount = 10)
{
return await VersionRepository.GetPagedListAsync(platformType, filter, soring, includeDetails, skipCount, maxResultCount);
}
[UnitOfWork]
public async virtual Task CreateAsync(AppVersion version)
{
await VersionRepository.InsertAsync(version);
}
[UnitOfWork]
public async virtual Task UpdateAsync(AppVersion version)
{
await VersionRepository.UpdateAsync(version);
}
[UnitOfWork]
public async virtual Task DeleteAsync(Guid id)
{
await RemoveAllFileAsync(id);
await VersionRepository.DeleteAsync(id);
}
public async virtual Task<AppVersion> GetLatestAsync(PlatformType platformType)
{
return await VersionRepository.GetLatestVersionAsync(platformType);
}
public async virtual Task<Stream> DownloadFileAsync(PlatformType platformType, string version, string filePath, string fileName, string fileVersion)
{
var appVersion = await GetByVersionAsync(platformType, version);
var versionFile = appVersion.FindFile(filePath, fileName, fileVersion);
if (versionFile == null)
{
throw new BusinessException(PlatformErrorCodes.VersionFileNotFound)
.WithData("FileName", fileName)
.WithData("FileVersion", fileVersion);
}
versionFile.Download();
return await VersionBlobContainer.GetAsync(
VersionFile.NormalizeBlobName(version, versionFile.Name, versionFile.Version, versionFile.Path));
}
public async virtual Task<Stream> GetFileAsync(VersionFile versionFile)
{
versionFile.Download();
return await VersionBlobContainer.GetAsync(
VersionFile.NormalizeBlobName(versionFile.AppVersion.Version, versionFile.Name, versionFile.Version, versionFile.Path));
}
public async virtual Task<string> SaveFileAsync(string version, string filePath, string fileName, string fileVersion, byte[] data)
{
// 计算指纹
var sha256 = SHA256.Create();
var checkHash = sha256.ComputeHash(data);
var sha256Hash = BitConverter.ToString(checkHash).Replace("-", string.Empty);
await VersionBlobContainer
.SaveAsync(VersionFile.NormalizeBlobName(version, fileName, fileVersion, filePath), data, true);
return sha256Hash;
}
[UnitOfWork]
public async virtual Task AppendFileAsync(Guid versionId, string fileSha256,
string fileName, string fileVersion,
long fileSize, string filePath = "",
FileType fileType = FileType.Stream)
{
var appVersion = await VersionRepository.GetAsync(versionId);
if (appVersion.FileExists(fileName))
{
appVersion.RemoveFile(fileName);
}
appVersion.AppendFile(fileName, fileVersion, fileSize, fileSha256, filePath, fileType);
}
[UnitOfWork]
public async virtual Task RemoveFileAsync(Guid versionId, string fileName)
{
var appVersion = await VersionRepository.GetAsync(versionId);
var versionFile = appVersion.FindFile(fileName);
if (versionFile != null)
{
await VersionBlobContainer
.DeleteAsync(VersionFile.NormalizeBlobName(appVersion.Version, versionFile.Name, versionFile.Version));
appVersion.RemoveFile(fileName);
}
}
[UnitOfWork]
public async virtual Task RemoveAllFileAsync(Guid versionId)
{
var appVersion = await VersionRepository.GetAsync(versionId);
foreach (var versionFile in appVersion.Files)
{
await VersionBlobContainer
.DeleteAsync(VersionFile.NormalizeBlobName(appVersion.Version, versionFile.Name, versionFile.Version));
}
appVersion.RemoveAllFile();
}
}
}

32
aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/Linq/Expressions/ExpressionFuncExtensions.cs

@ -0,0 +1,32 @@
using Volo.Abp.Specifications;
namespace System.Linq.Expressions;
internal static class ExpressionFuncExtensions
{
public static Expression<Func<T, bool>> AndIf<T>(
this Expression<Func<T, bool>> first,
bool condition,
Expression<Func<T, bool>> second)
{
if (condition)
{
return ExpressionFuncExtender.And(first, second);
}
return first;
}
public static Expression<Func<T, bool>> OrIf<T>(
this Expression<Func<T, bool>> first,
bool condition,
Expression<Func<T, bool>> second)
{
if (condition)
{
return ExpressionFuncExtender.Or(first, second);
}
return first;
}
}

4
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs

@ -1,7 +1,7 @@
using LINGYUN.Platform.Datas; using LINGYUN.Platform.Datas;
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.Versions; using LINGYUN.Platform.Packages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -14,6 +14,6 @@ namespace LINGYUN.Platform.EntityFrameworkCore
DbSet<Menu> Menus { get; set; } DbSet<Menu> Menus { get; set; }
DbSet<Layout> Layouts { get; set; } DbSet<Layout> Layouts { get; set; }
DbSet<Data> Datas { get; set; } DbSet<Data> Datas { get; set; }
DbSet<AppVersion> AppVersions { get; set; } DbSet<Package> Packages { get; set; }
} }
} }

5
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs

@ -1,7 +1,7 @@
using LINGYUN.Platform.Datas; using LINGYUN.Platform.Datas;
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.Versions; using LINGYUN.Platform.Packages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data; using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
@ -14,8 +14,7 @@ namespace LINGYUN.Platform.EntityFrameworkCore
public DbSet<Menu> Menus { get; set; } public DbSet<Menu> Menus { get; set; }
public DbSet<Layout> Layouts { get; set; } public DbSet<Layout> Layouts { get; set; }
public DbSet<Data> Datas { get; set; } public DbSet<Data> Datas { get; set; }
public DbSet<Package> Packages { get; set; }
public DbSet<AppVersion> AppVersions { get; set; }
public PlatformDbContext(DbContextOptions<PlatformDbContext> options) public PlatformDbContext(DbContextOptions<PlatformDbContext> options)
: base(options) : base(options)

81
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs

@ -2,8 +2,8 @@
using LINGYUN.Platform.Datas; using LINGYUN.Platform.Datas;
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.Packages;
using LINGYUN.Platform.Routes; using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders; using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System; using System;
@ -174,61 +174,72 @@ namespace LINGYUN.Platform.EntityFrameworkCore
x.HasIndex(i => new { i.Name }); x.HasIndex(i => new { i.Name });
}); });
builder.Entity<Package>(x =>
builder.Entity<AppVersion>(x =>
{ {
x.ToTable(options.TablePrefix + "Version", options.Schema); x.ToTable(options.TablePrefix + "Packages", options.Schema);
x.Property(p => p.Title) x.Property(p => p.Name)
.IsRequired() .IsRequired()
.HasColumnName(nameof(AppVersion.Title)) .HasColumnName(nameof(Package.Name))
.HasMaxLength(AppVersionConsts.MaxTitleLength); .HasMaxLength(PackageConsts.MaxNameLength);
x.Property(p => p.Version) x.Property(p => p.Note)
.IsRequired() .IsRequired()
.HasColumnName(nameof(AppVersion.Version)) .HasColumnName(nameof(Package.Note))
.HasMaxLength(AppVersionConsts.MaxVersionLength); .HasMaxLength(PackageConsts.MaxNoteLength);
x.Property(p => p.Version)
.IsRequired()
.HasColumnName(nameof(Package.Version))
.HasMaxLength(PackageConsts.MaxVersionLength);
x.Property(p => p.Description) x.Property(p => p.Description)
.HasColumnName(nameof(AppVersion.Description)) .HasColumnName(nameof(Package.Description))
.HasMaxLength(AppVersionConsts.MaxDescriptionLength); .HasMaxLength(PackageConsts.MaxDescriptionLength);
x.Property(p => p.Authors)
.HasColumnName(nameof(Package.Authors))
.HasMaxLength(PackageConsts.MaxAuthorsLength);
x.ConfigureByConvention(); x.ConfigureByConvention();
x.HasIndex(i => i.Version); x.HasIndex(i => new { i.Name, i.Version });
x.HasMany(p => p.Files) x.HasMany(p => p.Blobs)
.WithOne(q => q.AppVersion) .WithOne(q => q.Package)
.HasPrincipalKey(pk => pk.Id) .HasPrincipalKey(pk => pk.Id)
.HasForeignKey(fk => fk.AppVersionId) .HasForeignKey(fk => fk.PackageId)
.OnDelete(DeleteBehavior.Cascade); .OnDelete(DeleteBehavior.Cascade);
}); });
builder.Entity<VersionFile>(x => builder.Entity<PackageBlob>(x =>
{ {
x.ToTable(options.TablePrefix + "VersionFile", options.Schema); x.ToTable(options.TablePrefix + "PackageBlobs", options.Schema);
x.Property(p => p.Name) x.Property(p => p.Name)
.IsRequired() .IsRequired()
.HasColumnName(nameof(VersionFile.Name)) .HasColumnName(nameof(PackageBlob.Name))
.HasMaxLength(VersionFileConsts.MaxNameLength); .HasMaxLength(PackageBlobConsts.MaxNameLength);
x.Property(p => p.SHA256)
.IsRequired()
.HasColumnName(nameof(VersionFile.SHA256))
.HasMaxLength(VersionFileConsts.MaxSHA256Length);
x.Property(p => p.Version)
.IsRequired()
.HasColumnName(nameof(VersionFile.Version))
.HasMaxLength(VersionFileConsts.MaxVersionLength);
x.Property(p => p.Path) x.Property(p => p.SHA256)
.HasColumnName(nameof(VersionFile.Path)) .HasColumnName(nameof(PackageBlob.SHA256))
.HasMaxLength(VersionFileConsts.MaxPathLength); .HasMaxLength(PackageBlobConsts.MaxSHA256Length);
x.Property(p => p.Url)
.HasColumnName(nameof(PackageBlob.Url))
.HasMaxLength(PackageBlobConsts.MaxUrlLength);
x.Property(p => p.Summary)
.HasColumnName(nameof(PackageBlob.Summary))
.HasMaxLength(PackageBlobConsts.MaxSummaryLength);
x.Property(p => p.Authors)
.HasColumnName(nameof(PackageBlob.Authors))
.HasMaxLength(PackageBlobConsts.MaxAuthorsLength);
x.Property(p => p.License)
.HasColumnName(nameof(PackageBlob.License))
.HasMaxLength(PackageBlobConsts.MaxLicenseLength);
x.Property(p => p.ContentType)
.HasColumnName(nameof(PackageBlob.ContentType))
.HasMaxLength(PackageBlobConsts.MaxContentTypeLength);
x.ConfigureAudited(); x.ConfigureByConvention();
x.ConfigureMultiTenant();
x.HasIndex(i => new { i.Path, i.Name, i.Version }).IsUnique(); x.HasIndex(i => new { i.PackageId, i.Name });
}); });
} }

13
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEfCoreQueryableExtensions.cs

@ -1,6 +1,7 @@
using LINGYUN.Platform.Datas; using LINGYUN.Platform.Datas;
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.Packages;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System.Linq; using System.Linq;
@ -40,5 +41,17 @@ namespace LINGYUN.Platform.EntityFrameworkCore
.AsSplitQuery() .AsSplitQuery()
.Include(x => x.Items); .Include(x => x.Items);
} }
public static IQueryable<Package> IncludeDetails(this IQueryable<Package> queryable, bool include = true)
{
if (!include)
{
return queryable;
}
return queryable
.AsSplitQuery()
.Include(x => x.Blobs);
}
} }
} }

11
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs

@ -1,8 +1,7 @@
using LINGYUN.Platform.Datas; using LINGYUN.Platform.Datas;
using LINGYUN.Platform.Layouts; using LINGYUN.Platform.Layouts;
using LINGYUN.Platform.Menus; using LINGYUN.Platform.Menus;
using LINGYUN.Platform.Versions; using LINGYUN.Platform.Packages;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
@ -24,15 +23,9 @@ namespace LINGYUN.Platform.EntityFrameworkCore
options.AddRepository<RoleMenu, EfCoreRoleMenuRepository>(); options.AddRepository<RoleMenu, EfCoreRoleMenuRepository>();
options.AddRepository<UserFavoriteMenu, EfCoreUserFavoriteMenuRepository>(); options.AddRepository<UserFavoriteMenu, EfCoreUserFavoriteMenuRepository>();
options.AddRepository<Layout, EfCoreLayoutRepository>(); options.AddRepository<Layout, EfCoreLayoutRepository>();
options.AddRepository<AppVersion, EfCoreVersionRepository>(); options.AddRepository<Package, EfCorePackageRepository>();
options.AddDefaultRepositories(includeAllEntities: true); options.AddDefaultRepositories(includeAllEntities: true);
options.Entity<AppVersion>(appVersion =>
{
appVersion.DefaultWithDetailsFunc = (x) =>
x.Include(q => q.Files);
});
}); });
} }
} }

80
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs

@ -0,0 +1,80 @@
using LINGYUN.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Specifications;
namespace LINGYUN.Platform.Packages;
public class EfCorePackageRepository :
EfCoreRepository<PlatformDbContext, Package, Guid>,
IPackageRepository
{
public EfCorePackageRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public async virtual Task<Package> FindByNameAsync(
string name,
bool includeDetails = true,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(x => x.Name == name)
.OrderByDescending(x => x.Version)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public async virtual Task<Package> FindLatestAsync(
string name,
bool includeDetails = true,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.IncludeDetails(includeDetails)
.Where(x => x.Name == name)
.OrderByDescending(x => x.Version)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public async virtual Task<int> GetCountAsync(
Specification<Package> specification,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Where(specification.ToExpression())
.CountAsync(GetCancellationToken(cancellationToken));
}
public async virtual Task<List<Package>> GetListAsync(
Specification<Package> specification,
string sorting = $"{nameof(Package.Version)} DESC",
int skipCount = 0,
int maxResultCount = 10,
CancellationToken cancellationToken = default)
{
if (sorting.IsNullOrWhiteSpace())
{
sorting = $"{nameof(Package.Version)} DESC";
}
return await (await GetDbSetAsync())
.Where(specification.ToExpression())
.OrderBy(sorting)
.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async override Task<IQueryable<Package>> WithDetailsAsync()
{
return (await GetQueryableAsync()).IncludeDetails();
}
}

68
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Versions/EfCoreVersionRepository.cs

@ -1,68 +0,0 @@
using LINGYUN.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Versions
{
public class EfCoreVersionRepository : EfCoreRepository<IPlatformDbContext, AppVersion, Guid>, IVersionRepository, ITransientDependency
{
public EfCoreVersionRepository(
IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public async virtual Task<long> GetCountAsync(PlatformType platformType, string filter = "", CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Where(x => (platformType | x.PlatformType) == x.PlatformType)
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Version.Contains(filter) || x.Title.Contains(filter))
.LongCountAsync(GetCancellationToken(cancellationToken));
}
public async virtual Task<List<AppVersion>> GetPagedListAsync(PlatformType platformType, string filter = "", string soring = nameof(AppVersion.CreationTime), bool includeDetails = true, int skipCount = 1, int maxResultCount = 10, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.IncludeIf(includeDetails, x => x.Files)
.Where(x => (platformType | x.PlatformType) == x.PlatformType)
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Version.Contains(filter) || x.Title.Contains(filter))
.OrderBy($"{nameof(AppVersion.CreationTime)} DESC")
.ThenBy(soring ?? nameof(AppVersion.Version))
.PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async virtual Task<bool> ExistsAsync(PlatformType platformType, string version, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.AnyAsync(x => (platformType | x.PlatformType) == x.PlatformType && x.Version.Equals(version), GetCancellationToken(cancellationToken));
}
public async virtual Task<AppVersion> GetByVersionAsync(PlatformType platformType, string version, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Include(x => x.Files)
.Where(x => (platformType | x.PlatformType) == x.PlatformType && x.Version.Equals(version))
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public async virtual Task<AppVersion> GetLatestVersionAsync(PlatformType platformType, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.Include(x => x.Files)
.Where(x => (platformType | x.PlatformType) == x.PlatformType)
.OrderBy($"{nameof(AppVersion.CreationTime)} DESC")
.ThenBy(nameof(AppVersion.Version))
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
}
}

97
aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Packages/PackageController.cs

@ -0,0 +1,97 @@
using LINGYUN.Platform.Permissions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Content;
namespace LINGYUN.Platform.Packages;
[RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)]
[Area("platform")]
[Route("api/platform/packages")]
public class PackageController : PlatformControllerBase, IPackageAppService
{
private readonly IPackageAppService _service;
public PackageController(IPackageAppService service)
{
_service = service;
}
[HttpPost]
[Authorize(PlatformPermissions.Package.Create)]
public virtual Task<PackageDto> CreateAsync(PackageCreateDto input)
{
return _service.CreateAsync(input);
}
[HttpDelete]
[Route("{id}")]
[Authorize(PlatformPermissions.Package.Delete)]
public virtual Task DeleteAsync(Guid id)
{
return _service.DeleteAsync(id);
}
[HttpPost]
[Route("{id}/blob")]
[Authorize(PlatformPermissions.Package.ManageBlobs)]
public virtual Task<PackageBlobDto> UploadBlobAsync(
Guid id,
[FromForm] PackageBlobUploadDto input)
{
return _service.UploadBlobAsync(id, input);
}
[HttpDelete]
[Route("{id}/blob/{Name}")]
[Authorize(PlatformPermissions.Package.ManageBlobs)]
public virtual Task RemoveBlobAsync(
Guid id,
PackageBlobRemoveDto input)
{
return _service.RemoveBlobAsync(id, input);
}
[HttpGet]
[Route("{id}/blob/{Name}")]
[AllowAnonymous]
public virtual Task<IRemoteStreamContent> DownloadBlobAsync(Guid id, PackageBlobDownloadInput input)
{
return _service.DownloadBlobAsync(id, input);
}
[HttpGet]
[Route("{id}")]
[AllowAnonymous]
public virtual Task<PackageDto> GetAsync(Guid id)
{
return _service.GetAsync(id);
}
[HttpGet]
[Route("{Name}/latest")]
[AllowAnonymous]
public virtual Task<PackageDto> GetLatestAsync(PackageGetLatestInput input)
{
return _service.GetLatestAsync(input);
}
[HttpGet]
[Authorize(PlatformPermissions.Package.Default)]
public virtual Task<PagedResultDto<PackageDto>> GetListAsync(PackageGetPagedListInput input)
{
return _service.GetListAsync(input);
}
[HttpPut]
[Route("{id}")]
[Authorize(PlatformPermissions.Package.Update)]
public virtual Task<PackageDto> UpdateAsync(Guid id, PackageUpdateDto input)
{
return _service.UpdateAsync(id, input);
}
}

224
aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs

@ -1,224 +0,0 @@
using LINGYUN.Platform.Permissions;
using LINGYUN.Platform.Settings;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using System;
using System.ComponentModel.DataAnnotations;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.IO;
using Volo.Abp.Settings;
namespace LINGYUN.Platform.Versions
{
[RemoteService(Name = PlatformRemoteServiceConsts.RemoteServiceName)]
[Area("platform")]
[Route("api/platform/version")]
public class VersionController : PlatformControllerBase, IVersionAppService
{
private readonly IVersionFileManager _versionFileManager;
private readonly IVersionAppService _versionAppService;
public VersionController(
IVersionAppService versionAppService,
IVersionFileManager versionFileManager)
{
_versionAppService = versionAppService;
_versionFileManager = versionFileManager;
}
[HttpPost]
[Route("file/append")]
[RequestSizeLimit(200_000_000)]
public async virtual Task AppendFileAsync([FromQuery] VersionFileCreateDto versionFileCreate)
{
// 检查文件大小
var fileSizeLimited = await SettingProvider
.GetAsync(PlatformSettingNames.AppVersion.VersionFileLimitLength, AppVersionConsts.DefaultVersionFileLimitLength);
if (fileSizeLimited * 1024 * 1024 < versionFileCreate.TotalByte)
{
throw new UserFriendlyException(L["UploadFileSizeBeyondLimit", fileSizeLimited]);
}
// 采用分块模式上传文件
// 保存分块到临时目录
var fileName = versionFileCreate.FileName;
// 文件扩展名
var fileExtensionName = FileHelper.GetExtension(fileName);
var fileAllowExtension = await SettingProvider
.GetOrNullAsync(PlatformSettingNames.AppVersion.AllowVersionFileExtensions);
if (fileAllowExtension.IsNullOrWhiteSpace())
{
fileAllowExtension = AppVersionConsts.DefaultAllowVersionFileExtensions;
}
// 检查文件扩展名
if (!fileAllowExtension.Split(',').Any(fe => fe.Equals(fileExtensionName, StringComparison.CurrentCultureIgnoreCase)))
{
throw new UserFriendlyException(L["NotAllowedFileExtensionName", fileExtensionName]);
}
// 当前计算机临时目录
var tempFilePath = Environment.GetFolderPath(Environment.SpecialFolder.Templates);
// 以上传的文件名创建一个临时目录
tempFilePath = Path.Combine(tempFilePath, "lingyun-platform", Path.GetFileNameWithoutExtension(fileName));
// 以上传的分片索引创建临时文件
var tempSavedFile = Path.Combine(tempFilePath, $"{versionFileCreate.CurrentByte}.{fileExtensionName}");
if (!Directory.Exists(tempFilePath))
{
// 临时目录不存在则创建
Directory.CreateDirectory(tempFilePath);
}
try
{
if (HttpContext.RequestAborted.IsCancellationRequested)
{
// 如果取消请求,删除临时目录
Directory.Delete(tempFilePath, true);
return;
}
// 保存临时文件
using (var fs = new FileStream(tempSavedFile, FileMode.Create, FileAccess.Write))
{
// 写入当前分片文件
await Request.Body.CopyToAsync(fs);
}
if (versionFileCreate.CurrentByte == versionFileCreate.TotalByte)
{
// 合并文件
var mergeSavedFile = Path.Combine(tempFilePath, $"{fileName}");
// 获取并排序所有分片文件
var mergeFiles = Directory.GetFiles(tempFilePath).OrderBy(f => f.Length).ThenBy(f => f);
// 创建临时合并文件
using (var mergeSavedFileStream = new FileStream(mergeSavedFile, FileMode.Create))
{
foreach (var mergeFile in mergeFiles)
{
// 读取当前文件字节
var mergeFileBytes = await FileHelper.ReadAllBytesAsync(mergeFile);
// 写入到合并文件流
await mergeSavedFileStream.WriteAsync(mergeFileBytes,0, mergeFileBytes.Length);
// 删除已参与合并的临时文件分片
FileHelper.DeleteIfExists(mergeFile);
}
// 上传最终合并的文件并取得SHA256指纹
var fileData = await mergeSavedFileStream.GetAllBytesAsync();
versionFileCreate.SHA256 = await _versionFileManager.SaveFileAsync(versionFileCreate.Version,
versionFileCreate.FilePath, versionFileCreate.FileName, versionFileCreate.FileVersion, fileData);
}
// 添加到版本信息
await _versionAppService.AppendFileAsync(versionFileCreate);
// 文件保存之后删除临时文件目录
Directory.Delete(tempFilePath, true);
}
}
catch
{
// 发生异常删除临时文件目录
Directory.Delete(tempFilePath, true);
throw;
}
}
[HttpPost]
public async virtual Task<VersionDto> CreateAsync(VersionCreateDto versionCreate)
{
return await _versionAppService.CreateAsync(versionCreate);
}
[HttpDelete]
public async virtual Task DeleteAsync(VersionDeleteDto versionDelete)
{
await _versionAppService.DeleteAsync(versionDelete);
}
[HttpGet]
public async virtual Task<PagedResultDto<VersionDto>> GetAsync(VersionGetByPagedDto versionGetByPaged)
{
return await _versionAppService.GetAsync(versionGetByPaged);
}
[HttpGet]
[Route("{Id}")]
public async virtual Task<VersionDto> GetAsync(VersionGetByIdDto versionGetById)
{
return await _versionAppService.GetAsync(versionGetById);
}
[HttpGet]
[Route("lastest")]
public async virtual Task<VersionDto> GetLastestAsync([Required] PlatformType platformType)
{
return await _versionAppService.GetLastestAsync(platformType);
}
[HttpDelete]
[Route("file/clean")]
public async virtual Task RemoveAllFileAsync(VersionGetByIdDto versionGetById)
{
await _versionAppService.RemoveAllFileAsync(versionGetById);
}
[HttpDelete]
[Route("file/remove")]
public async virtual Task RemoveFileAsync(VersionFileDeleteDto versionFileDelete)
{
await _versionAppService.RemoveFileAsync(versionFileDelete);
}
[HttpGet]
[Route("file/download")]
[Authorize(PlatformPermissions.AppVersion.FileManager.Download)]
public async virtual Task DownloadFileAsync(VersionFileGetDto versionFileGet)
{
// 分块模式下载文件
// 得到文件流
var fileStream = await _versionFileManager.DownloadFileAsync(
versionFileGet.PlatformType, versionFileGet.Version, versionFileGet.FilePath,
versionFileGet.FileName, versionFileGet.FileVersion);
// 得到文件扩展名
var fileExt = Path.GetExtension(versionFileGet.FileName);
var provider = new FileExtensionContentTypeProvider();
// Http响应标头的文件类型
string memi = provider.Mappings[fileExt];
using (Response.Body)
{
// Http响应标头的文件类型
Response.ContentType = memi;
// 文件大小
byte[] contentBytes = await fileStream.GetAllBytesAsync();
long contentLength = contentBytes.Length;
// 指定响应内容大小
Response.ContentLength = contentLength;
// 单个分块大小 2MB
int bufferSize = 2 * 1024 * 1024;
// 分块总数
int contentByteCount = Math.DivRem(contentBytes.Length, bufferSize, out int modResult);
for (int index = 0; index < contentByteCount; index++)
{
// 当前分页传输字节
byte[] currentTransferBytes = new byte[bufferSize];
if (index == contentByteCount - 1)
{
// 最后一个分块和余数大小一起传输
if (modResult > 0)
{
currentTransferBytes = new byte[bufferSize + modResult];
}
}
// 复制文件流中的当前分块区段
Array.Copy(contentBytes, index * bufferSize, currentTransferBytes, 0, currentTransferBytes.Length);
// 写入响应流
await Response.Body.WriteAsync(currentTransferBytes, 0, currentTransferBytes.Length);
// 清空缓冲区
await Response.Body.FlushAsync();
}
}
}
}
}

2
aspnet-core/modules/task-management/LINGYUN.Abp.BackgroundTasks.Quartz/LINGYUN/Abp/BackgroundTasks/Quartz/QuartzJobSimpleAdapter.cs

@ -25,7 +25,7 @@ public class QuartzJobSimpleAdapter<TJobRunnable> : IJob
typeof(TJobRunnable), typeof(TJobRunnable),
scope.ServiceProvider, scope.ServiceProvider,
context.MergedJobDataMap.ToImmutableDictionary(), context.MergedJobDataMap.ToImmutableDictionary(),
getCache: (key) => context.Get(key), getCache: context.Get,
setCache: context.Put, setCache: context.Put,
cancellationToken: context.CancellationToken); cancellationToken: context.CancellationToken);

12
aspnet-core/modules/tenants/LINGYUN.Abp.MultiTenancy.Saas/Properties/launchSettings.json

@ -0,0 +1,12 @@
{
"profiles": {
"LINGYUN.Abp.MultiTenancy.Saas": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "https://localhost:58776;http://localhost:58777"
}
}
}

38
aspnet-core/modules/text-templating/LINGYUN.Abp.TextTemplating.EntityFrameworkCore/LINGYUN.Abp.TextTemplating.EntityFrameworkCore.csproj

@ -1,19 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" /> <Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="$(VoloAbpPackageVersion)" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Domain\LINGYUN.Abp.TextTemplating.Domain.csproj" /> <ProjectReference Include="..\LINGYUN.Abp.TextTemplating.Domain\LINGYUN.Abp.TextTemplating.Domain.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save