Browse Source

rename platform-module to backend-admin-app and add platform-module

pull/26/head
cKey 5 years ago
parent
commit
a18beae56e
  1. 102
      aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationStore.cs
  2. 28
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj
  3. 10
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs
  4. 26
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionCreateDto.cs
  5. 7
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDeleteDto.cs
  6. 30
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDto.cs
  7. 45
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileCreateDto.cs
  8. 10
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDeleteDto.cs
  9. 29
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDto.cs
  10. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileGetDto.cs
  11. 9
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionGetByIdDto.cs
  12. 9
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionGetByPagedDto.cs
  13. 27
      aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/IVersionAppService.cs
  14. 21
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN.Platform.Application.csproj
  15. 14
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs
  16. 20
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs
  17. 12
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationServiceBase.cs
  18. 93
      aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Versions/VersionAppService.cs
  19. 30
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj
  20. 10
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/PlatformResource.cs
  21. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json
  22. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json
  23. 18
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatformModuleExtensionConfigurationDictionaryExtensions.cs
  24. 14
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatformModuleExtensionConsts.cs
  25. 26
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatfromModuleExtensionConfiguration.cs
  26. 34
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs
  27. 60
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformType.cs
  28. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteConsts.cs
  29. 12
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteEto.cs
  30. 53
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteConsts.cs
  31. 17
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs
  32. 12
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/UserRouteEto.cs
  33. 20
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Settings/PlatformSettingNames.cs
  34. 14
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/AppVersionConsts.cs
  35. 33
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/AppVersionEto.cs
  36. 21
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/FileType.cs
  37. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/IVersionFileManager.cs
  38. 22
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/ImportantLevel.cs
  39. 15
      aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Versions/VersionFileConsts.cs
  40. 27
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN.Platform.Domain.csproj
  41. 11
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs
  42. 19
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs
  43. 60
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs
  44. 78
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteRepository.cs
  45. 31
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RoleRoute.cs
  46. 190
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs
  47. 139
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteManager.cs
  48. 29
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/UserRoute.cs
  49. 31
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Settings/PlatformSettingDefinitionProvider.cs
  50. 95
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/AppVersion.cs
  51. 21
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/IVersionRepository.cs
  52. 9
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionContainer.cs
  53. 93
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionFile.cs
  54. 138
      aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionManager.cs
  55. 24
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN.Platform.EntityFrameworkCore.csproj
  56. 15
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs
  57. 29
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs
  58. 138
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs
  59. 32
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs
  60. 18
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs
  61. 141
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Routes/EfCoreRouteRepository.cs
  62. 63
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Versions/EfCoreVersionRepository.cs
  63. 24
      aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN.Platform.HttpApi.csproj
  64. 17
      aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformControllerBase.cs
  65. 31
      aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs
  66. 217
      aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs
  67. 4
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/.gitignore
  68. 257
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
  69. 2
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Controllers/LocationController.cs
  70. 31
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContext.cs
  71. 29
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContextFactory.cs
  72. 0
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs
  73. 2
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EventBus/Handlers/TenantConnectionStringCreateEventHandler.cs
  74. 2
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EventBus/Handlers/TenantCreateEventHandler.cs
  75. 2
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EventBus/Handlers/TenantDeleteEventHandler.cs
  76. 83
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
  77. 0
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN/BackendAdmin/Identity/Localization/en.json
  78. 0
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN/BackendAdmin/Identity/Localization/zh-Hans.json
  79. 6
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs
  80. 2
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs
  81. 6
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs
  82. 2
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs
  83. 6
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs
  84. 35
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/MultiTenancy/AuthorizationTenantResolveContributor.cs
  85. 49
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Program.cs
  86. 20
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Properties/launchSettings.json
  87. 18
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Startup.cs
  88. 0
      aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/tempkey.rsa
  89. 6
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/.gitignore
  90. 16
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContext.cs
  91. 2
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContextFactory.cs
  92. 51
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj
  93. 397
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723133732_Add-Platform-Module.Designer.cs
  94. 206
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723133732_Add-Platform-Module.cs
  95. 397
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723143103_Modify-Version-File-SHA256-Length.Designer.cs
  96. 31
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723143103_Modify-Version-File-SHA256-Length.cs
  97. 395
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs
  98. 108
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs
  99. 2
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Program.cs
  100. 4
      aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Properties/launchSettings.json

102
aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/NullNotificationStore.cs

@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
namespace LINGYUN.Abp.Notifications
{
[Dependency(Microsoft.Extensions.DependencyInjection.ServiceLifetime.Singleton, TryRegister = true)]
[ExposeServices(typeof(INotificationStore))]
public class NullNotificationStore : INotificationStore
{
public Task ChangeUserNotificationReadStateAsync(Guid? tenantId, Guid userId, long notificationId, NotificationReadState readState)
{
return Task.CompletedTask;
}
public Task DeleteAllUserSubscriptionAsync(Guid? tenantId, string notificationName)
{
return Task.CompletedTask;
}
public Task DeleteNotificationAsync(NotificationInfo notification)
{
return Task.CompletedTask;
}
public Task DeleteNotificationAsync(int batchCount)
{
return Task.CompletedTask;
}
public Task DeleteUserNotificationAsync(Guid? tenantId, Guid userId, long notificationId)
{
return Task.CompletedTask;
}
public Task DeleteUserSubscriptionAsync(Guid? tenantId, Guid userId, string notificationName)
{
return Task.CompletedTask;
}
public Task DeleteUserSubscriptionAsync(Guid? tenantId, IEnumerable<UserIdentifier> identifiers, string notificationName)
{
return Task.CompletedTask;
}
public Task<NotificationInfo> GetNotificationOrNullAsync(Guid? tenantId, long notificationId)
{
return Task.FromResult(new NotificationInfo());
}
public Task<List<NotificationSubscriptionInfo>> GetSubscriptionsAsync(Guid? tenantId, string notificationName)
{
return Task.FromResult(new List<NotificationSubscriptionInfo>());
}
public Task<List<NotificationInfo>> GetUserNotificationsAsync(Guid? tenantId, Guid userId, NotificationReadState readState = NotificationReadState.UnRead, int maxResultCount = 10)
{
return Task.FromResult(new List<NotificationInfo>());
}
public Task<List<NotificationSubscriptionInfo>> GetUserSubscriptionsAsync(Guid? tenantId, Guid userId)
{
return Task.FromResult(new List<NotificationSubscriptionInfo>());
}
public Task<List<NotificationSubscriptionInfo>> GetUserSubscriptionsAsync(Guid? tenantId, string userName)
{
return Task.FromResult(new List<NotificationSubscriptionInfo>());
}
public Task InsertNotificationAsync(NotificationInfo notification)
{
return Task.CompletedTask;
}
public Task InsertUserNotificationAsync(NotificationInfo notification, Guid userId)
{
return Task.CompletedTask;
}
public Task InsertUserNotificationsAsync(NotificationInfo notification, IEnumerable<Guid> userIds)
{
return Task.CompletedTask;
}
public Task InsertUserSubscriptionAsync(Guid? tenantId, UserIdentifier identifier, string notificationName)
{
return Task.CompletedTask;
}
public Task InsertUserSubscriptionAsync(Guid? tenantId, IEnumerable<UserIdentifier> identifiers, string notificationName)
{
return Task.CompletedTask;
}
public Task<bool> IsSubscribedAsync(Guid? tenantId, Guid userId, string notificationName)
{
return Task.FromResult(false);
}
}
}

28
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj

@ -0,0 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>3.0.0</Version>
<Authors>LINGYUN</Authors>
<Company />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Application" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="LINGYUN\Platform\Routes\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Platform.Domain.Shared\LINGYUN.Platform.Domain.Shared.csproj" />
</ItemGroup>
</Project>

10
aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs

@ -0,0 +1,10 @@
using Volo.Abp.Modularity;
namespace LINGYUN.Platform
{
[DependsOn(typeof(PlatformDomainSharedModule))]
public class PlatformApplicationContractModule : AbpModule
{
}
}

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

@ -0,0 +1,26 @@
using System.Collections.Generic;
namespace LINGYUN.Platform.Versions
{
public class VersionCreateDto
{
/// <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; } = ImportantLevel.Low;
public List<VersionFileDto> VersionFiles { get; set; } = new List<VersionFileDto>();
}
}

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

@ -0,0 +1,7 @@
namespace LINGYUN.Platform.Versions
{
public class VersionDeleteDto
{
public string Version { get; set; }
}
}

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

@ -0,0 +1,30 @@
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 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>();
}
}

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

@ -0,0 +1,45 @@
using Newtonsoft.Json;
using System;
using System.ComponentModel.DataAnnotations;
namespace LINGYUN.Platform.Versions
{
public class VersionFileCreateDto
{
[Required]
public Guid VersionId { get; set; }
[Required]
public string Version { 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; }
}
}

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

@ -0,0 +1,10 @@
using System;
namespace LINGYUN.Platform.Versions
{
public class VersionFileDeleteDto
{
public Guid VersionId { get; set; }
public string FileName { get; set; }
}
}

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

@ -0,0 +1,29 @@
using Newtonsoft.Json;
namespace LINGYUN.Platform.Versions
{
public class VersionFileDto
{
/// <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; }
}
}

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

@ -0,0 +1,11 @@
using System;
namespace LINGYUN.Platform.Versions
{
public class VersionFileGetDto
{
public string Version { get; set; }
public string FileName { get; set; }
public string FileVersion { get; set; }
}
}

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

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

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

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

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

@ -0,0 +1,27 @@
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();
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);
}
}

21
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN.Platform.Application.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>3.0.0</Version>
<Authors>LINGYUN</Authors>
<Company />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Platform.Application.Contracts\LINGYUN.Platform.Application.Contracts.csproj" />
<ProjectReference Include="..\LINGYUN.Platform.Domain\LINGYUN.Platform.Domain.csproj" />
</ItemGroup>
</Project>

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

@ -0,0 +1,14 @@
using AutoMapper;
using LINGYUN.Platform.Versions;
namespace LINGYUN.Platform
{
public class PlatformApplicationMappingProfile : Profile
{
public PlatformApplicationMappingProfile()
{
CreateMap<VersionFile, VersionFileDto>();
CreateMap<AppVersion, VersionDto>();
}
}
}

20
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs

@ -0,0 +1,20 @@
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
namespace LINGYUN.Platform
{
[DependsOn(typeof(PlatformApplicationContractModule))]
public class PlatformApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<PlatformApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<PlatformApplicationMappingProfile>(validate: true);
});
}
}
}

12
aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationServiceBase.cs

@ -0,0 +1,12 @@
using Volo.Abp.Application.Services;
namespace LINGYUN.Platform
{
public abstract class PlatformApplicationServiceBase : ApplicationService
{
protected PlatformApplicationServiceBase()
{
}
}
}

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

@ -0,0 +1,93 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Platform.Versions
{
public class VersionAppService : PlatformApplicationServiceBase, IVersionAppService
{
private readonly VersionManager _versionManager;
public VersionAppService(
VersionManager versionManager)
{
_versionManager = versionManager;
}
public virtual async Task AppendFileAsync(VersionFileCreateDto versionFileCreate)
{
await _versionManager.AppendFileAsync(versionFileCreate.VersionId,
versionFileCreate.SHA256, versionFileCreate.FileName, versionFileCreate.FileVersion,
versionFileCreate.TotalByte, versionFileCreate.FileType);
}
public virtual async Task<VersionDto> CreateAsync(VersionCreateDto versionCreate)
{
if (await _versionManager.ExistsAsync(versionCreate.Version))
{
throw new UserFriendlyException("VersionAlreadyExists");
}
var version = new AppVersion(GuidGenerator.Create(), versionCreate.Title,
versionCreate.Version, CurrentTenant.Id)
{
Description = versionCreate.Description,
Level = versionCreate.Level
};
await _versionManager.CreateAsync(version);
return ObjectMapper.Map<AppVersion, VersionDto>(version);
}
public virtual async Task DeleteAsync(VersionDeleteDto versionDelete)
{
var version = await _versionManager.GetByVersionAsync(versionDelete.Version);
if (version != null)
{
await _versionManager.DeleteAsync(version.Id);
}
}
public virtual async Task<PagedResultDto<VersionDto>> GetAsync(VersionGetByPagedDto versionGetByPaged)
{
var versionCount = await _versionManager.GetCountAsync(versionGetByPaged.Filter);
var versions = await _versionManager.GetPagedListAsync(versionGetByPaged.Filter,
versionGetByPaged.Sorting, true,
versionGetByPaged.SkipCount, versionGetByPaged.MaxResultCount);
return new PagedResultDto<VersionDto>(versionCount,
ObjectMapper.Map<List<AppVersion>, List<VersionDto>>(versions));
}
public virtual async Task<VersionDto> GetAsync(VersionGetByIdDto versionGetById)
{
var version = await _versionManager.GetByIdAsync(versionGetById.Id);
return ObjectMapper.Map<AppVersion, VersionDto>(version);
}
public virtual async Task<VersionDto> GetLastestAsync()
{
var version = await _versionManager.GetLatestAsync();
return ObjectMapper.Map<AppVersion, VersionDto>(version);
}
public virtual async Task RemoveAllFileAsync(VersionGetByIdDto versionGetById)
{
await _versionManager.RemoveAllFileAsync(versionGetById.Id);
}
public virtual async 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;
}
}
}

30
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN.Platform.Domain.Shared.csproj

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>3.0.0</Version>
<Authors>LINGYUN</Authors>
<Company />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>
<None Remove="LINGYUN\Platform\Localization\Resources\en.json" />
<None Remove="LINGYUN\Platform\Localization\Resources\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\Platform\Localization\Resources\en.json" />
<EmbeddedResource Include="LINGYUN\Platform\Localization\Resources\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.Validation" Version="3.0.0" />
</ItemGroup>
</Project>

10
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/PlatformResource.cs

@ -0,0 +1,10 @@
using Volo.Abp.Localization;
namespace LINGYUN.Platform.Localization
{
[LocalizationResourceName("AppPlatform")]
public class PlatformResource
{
}
}

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

@ -0,0 +1,11 @@
{
"culture": "en",
"texts": {
"UploadFileSizeBeyondLimit": "Upload file size cannot exceed {0} MB!",
"NotAllowedFileExtensionName": "Not allowed file extension: {0}!",
"DisplayName:VersionFileLimitLength": "File limit size",
"Description:VersionFileLimitLength": "Limit size of uploaded file in MB",
"DisplayName:AllowVersionFileExtensions": "File extension",
"Description:AllowVersionFileExtensions": "List of allowed extensions to upload files, with multiple extensions separated by, don't need a notation"
}
}

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

@ -0,0 +1,11 @@
{
"culture": "zh-Hans",
"texts": {
"UploadFileSizeBeyondLimit": "上传文件大小不能超过 {0} MB!",
"NotAllowedFileExtensionName": "不被允许的文件扩展名: {0}!",
"DisplayName:VersionFileLimitLength": "文件限制大小",
"Description:VersionFileLimitLength": "上传文件的限制大小,单位(MB)",
"DisplayName:AllowVersionFileExtensions": "文件扩展名",
"Description:AllowVersionFileExtensions": "允许的上传文件扩展名列表,多个扩展名以,分隔,无需输入.符号"
}
}

18
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/ObjectExtending/PlatformModuleExtensionConfigurationDictionaryExtensions.cs

@ -0,0 +1,18 @@
using System;
using Volo.Abp.ObjectExtending.Modularity;
namespace LINGYUN.Platform.ObjectExtending
{
public static class PlatformModuleExtensionConfigurationDictionaryExtensions
{
public static ModuleExtensionConfigurationDictionary ConfigurePlatform(
this ModuleExtensionConfigurationDictionary modules,
Action<PlatfromModuleExtensionConfiguration> configureAction)
{
return modules.ConfigureModule(
PlatformModuleExtensionConsts.ModuleName,
configureAction
);
}
}
}

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

@ -0,0 +1,14 @@
namespace LINGYUN.Platform.ObjectExtending
{
public class PlatformModuleExtensionConsts
{
public const string ModuleName = "AppPlatform";
public static class EntityNames
{
public const string Route = "Route";
public const string AppVersion = "AppVersion";
}
}
}

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

@ -0,0 +1,26 @@
using System;
using Volo.Abp.ObjectExtending.Modularity;
namespace LINGYUN.Platform.ObjectExtending
{
public class PlatfromModuleExtensionConfiguration : ModuleExtensionConfiguration
{
public PlatfromModuleExtensionConfiguration ConfigureRoute(
Action<EntityExtensionConfiguration> configureAction)
{
return this.ConfigureEntity(
PlatformModuleExtensionConsts.EntityNames.Route,
configureAction
);
}
public PlatfromModuleExtensionConfiguration ConfigureAppVersion(
Action<EntityExtensionConfiguration> configureAction)
{
return this.ConfigureEntity(
PlatformModuleExtensionConsts.EntityNames.AppVersion,
configureAction
);
}
}
}

34
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs

@ -0,0 +1,34 @@
using LINGYUN.Platform.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Localization.ExceptionHandling;
using Volo.Abp.Modularity;
using Volo.Abp.Validation.Localization;
using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Platform
{
[DependsOn(typeof(AbpLocalizationModule))]
public class PlatformDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<PlatformDomainSharedModule>();
});
Configure<AbpLocalizationOptions>(options =>
{
options.Resources
.Add<PlatformResource>("en")
.AddBaseTypes(typeof(AbpValidationResource))
.AddVirtualJson("/LINGYUN/Platform/Localization/Resources");
});
Configure<AbpExceptionLocalizationOptions>(options =>
{
options.MapCodeNamespace("LINGYUN.Platform", typeof(AbpValidationResource));
});
}
}
}

60
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformType.cs

@ -0,0 +1,60 @@
using System;
namespace LINGYUN.Platform
{
/// <summary>
/// 平台类型
/// </summary>
[Flags]
public enum PlatformType
{
/// <summary>
/// 未定义
/// </summary>
None = 0,
/// <summary>
/// Windows CE
/// </summary>
WinCe = 2,
/// <summary>
/// Windows NT
/// </summary>
WinForm = 4,
/// <summary>
/// Windows桌面通用
/// </summary>
Desktop = WinCe | WinForm,
/// <summary>
/// WebForm
/// </summary>
WebForm = 8,
/// <summary>
/// MVC
/// </summary>
WebMvc = 16,
/// <summary>
/// 其他Mvvm架构
/// </summary>
WebMvvm = 32,
/// <summary>
/// Web通用
/// </summary>
Web = WebForm | WebMvc,
/// <summary>
/// Android
/// </summary>
Android = 64,
/// <summary>
/// IOS
/// </summary>
iOS = 128,
/// <summary>
/// 移动端通用
/// </summary>
Mobile = Android | iOS,
/// <summary>
/// 所有平台通用
/// </summary>
All = Desktop | Web | Mobile
}
}

11
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteConsts.cs

@ -0,0 +1,11 @@
namespace LINGYUN.Platform.Routes
{
public class RoleRouteConsts
{
public static int MaxRoleNameLength
{
get;
set;
} = 256;
}
}

12
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RoleRouteEto.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Routes
{
public class RoleRouteEto : IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid RouteId { get; set; }
public string RoleName { get; set; }
}
}

53
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteConsts.cs

@ -0,0 +1,53 @@
namespace LINGYUN.Platform.Routes
{
public class RouteConsts
{
public static int MaxNameLength
{
get;
set;
} = 64;
public static int MaxFullNameLength
{
get;
set;
} = 128;
public static int MaxDisplayNameLength
{
get;
set;
} = 128;
public static int MaxDescriptionLength
{
get;
set;
} = 255;
public static int MaxIconLength
{
get;
set;
} = 128;
public static int MaxLinkUrlLength
{
get;
set;
} = 255;
/// <summary>
/// 层级深度
/// </summary>
public const int MaxDepth = 16;
/// <summary>
/// 编码长度
/// </summary>
public const int CodeUnitLength = 5;
/// <summary>
/// 编号最大长度
/// </summary>
public const int MaxCodeLength = MaxDepth * (CodeUnitLength + 1) - 1;
}
}

17
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/RouteEto.cs

@ -0,0 +1,17 @@
using System;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Routes
{
public class RouteEto : IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid Id { get; set; }
public string Code { get; set; }
public string Name { get; set; }
public string DisplayName { get; set; }
public string LinkUrl { get; set; }
public string Icon { get; set; }
public PlatformType PlatformType { get; set; }
}
}

12
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Routes/UserRouteEto.cs

@ -0,0 +1,12 @@
using System;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Routes
{
public class UserRouteEto : IMultiTenant
{
public Guid? TenantId { get; set; }
public Guid RouteId { get; set; }
public Guid UserId { get; set; }
}
}

20
aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Settings/PlatformSettingNames.cs

@ -0,0 +1,20 @@
namespace LINGYUN.Platform.Settings
{
public class PlatformSettingNames
{
public const string GroupName = "AppPlatform";
public class AppVersion
{
public const string Default = GroupName + ".AppVersion";
/// <summary>
/// 文件限制长度
/// </summary>
public const string VersionFileLimitLength = Default + ".VersionFileLimitLength";
/// <summary>
/// 允许的文件扩展名类型
/// </summary>
public const string AllowVersionFileExtensions = Default + ".AllowVersionFileExtensions";
}
}
}

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

@ -0,0 +1,14 @@
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

@ -0,0 +1,33 @@
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

@ -0,0 +1,21 @@
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

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

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

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

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

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace LINGYUN.Platform.Versions
{
public static class VersionFileConsts
{
public const int MaxNameLength = 255;
public const int MaxVersionLength = 20;
public const int MaxSHA256Length = 65;
}
}

27
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN.Platform.Domain.csproj

@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>3.0.0</Version>
<Authors>LINGYUN</Authors>
<Company />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AutoMapper" Version="3.0.0" />
<PackageReference Include="Volo.Abp.BlobStoring" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Settings" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Platform.Domain.Shared\LINGYUN.Platform.Domain.Shared.csproj" />
</ItemGroup>
</Project>

11
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs

@ -0,0 +1,11 @@
namespace LINGYUN.Platform
{
public static class PlatformDbProperties
{
public static string DbTablePrefix { get; set; } = "AppPlatform";
public static string DbSchema { get; set; } = null;
public const string ConnectionStringName = "AppPlatform";
}
}

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

@ -0,0 +1,19 @@
using AutoMapper;
using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
namespace LINGYUN.Platform
{
public class PlatformDomainMappingProfile : Profile
{
public PlatformDomainMappingProfile()
{
CreateMap<Route, RouteEto>();
CreateMap<UserRoute, UserRouteEto>();
CreateMap<RoleRoute, RoleRouteEto>();
CreateMap<AppVersion, AppVersionEto>()
.ForMember(eto => eto.FileCount, map => map.MapFrom(src => src.Files.Count));
}
}
}

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

@ -0,0 +1,60 @@
using LINGYUN.Platform.ObjectExtending;
using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AutoMapper;
using Volo.Abp.BlobStoring;
using Volo.Abp.Domain.Entities.Events.Distributed;
using Volo.Abp.EventBus;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectExtending.Modularity;
namespace LINGYUN.Platform
{
[DependsOn(
typeof(PlatformDomainSharedModule),
typeof(AbpBlobStoringModule),
typeof(AbpEventBusModule))]
public class PlatformDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<PlatformDomainModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<PlatformDomainMappingProfile>(validate: true);
});
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.Configure<VersionContainer>(containerConfiguration =>
{
containerConfiguration.IsMultiTenant = true;
});
});
Configure<AbpDistributedEntityEventOptions>(options =>
{
options.EtoMappings.Add<Route, RouteEto>(typeof(PlatformDomainModule));
options.EtoMappings.Add<UserRoute, UserRouteEto>(typeof(PlatformDomainModule));
options.EtoMappings.Add<RoleRoute, RoleRouteEto>(typeof(PlatformDomainModule));
options.EtoMappings.Add<AppVersion, AppVersionEto>(typeof(PlatformDomainModule));
});
}
public override void PostConfigureServices(ServiceConfigurationContext context)
{
ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity(
PlatformModuleExtensionConsts.ModuleName,
PlatformModuleExtensionConsts.EntityNames.Route,
typeof(Route)
);
ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity(
PlatformModuleExtensionConsts.ModuleName,
PlatformModuleExtensionConsts.EntityNames.AppVersion,
typeof(AppVersion)
);
}
}
}

78
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/IRouteRepository.cs

@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories;
namespace LINGYUN.Platform.Routes
{
public interface IRouteRepository : IBasicRepository<Route, Guid>
{
Task<List<Route>> GetChildrenAsync(
Guid? parentId,
CancellationToken cancellationToken = default
);
Task<List<Route>> GetAllChildrenWithParentCodeAsync(
string code,
Guid? parentId,
CancellationToken cancellationToken = default
);
Task<Route> GetAsync(
string displayName,
CancellationToken cancellationToken = default
);
Task<List<Route>> GetPagedListAsync(
string sorting = null,
int maxResultCount = int.MaxValue,
int skipCount = 0,
CancellationToken cancellationToken = default
);
Task<List<Route>> GetRolesRouteAsync(
string roleName,
CancellationToken cancellationToken = default
);
Task<List<Route>> GetUsersRouteAsync(
Guid userId,
CancellationToken cancellationToken = default
);
Task RemoveAllUsersRouteAsync(
Route route,
CancellationToken cancellationToken = default
);
Task RemoveUserRouteAsync(
Guid userId,
Route route,
CancellationToken cancellationToken = default
);
Task RemoveAllRolesRouteAsync(
Route route,
CancellationToken cancellationToken = default
);
Task RemoveRoleRouteAsync(
string roleName,
Route route,
CancellationToken cancellationToken = default
);
Task<bool> IsInRouteAsync(
string roleName,
Route route,
CancellationToken cancellationToken = default
);
Task<bool> IsInRouteAsync(
Guid userId,
Route route,
CancellationToken cancellationToken = default
);
}
}

31
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RoleRoute.cs

@ -0,0 +1,31 @@
using JetBrains.Annotations;
using System;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Routes
{
public class RoleRoute : FullAuditedEntity<int>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual string RoleName { get; protected set; }
public virtual Guid RouteId { get; protected set; }
protected RoleRoute()
{
}
public RoleRoute(int id)
{
Id = id;
}
public RoleRoute(Guid routeId, [NotNull] string roleName, Guid? tenantId = null)
{
RouteId = routeId;
TenantId = tenantId;
RoleName = Check.NotNullOrWhiteSpace(roleName, nameof(roleName));
}
}
}

190
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs

@ -0,0 +1,190 @@
using JetBrains.Annotations;
using System;
using System.Collections.Generic;
using System.Linq;
using Volo.Abp;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Routes
{
public class Route : FullAuditedAggregateRoot<Guid>, IMultiTenant
{
/// <summary>
/// 租户标识
/// </summary>
public virtual Guid? TenantId { get; protected set; }
/// <summary>
/// 编号
/// </summary>
public virtual string Code { get; set; }
/// <summary>
/// 名称
/// </summary>
public virtual string Name { get; protected set; }
/// <summary>
/// 全名
/// </summary>
public virtual string FullName { get; set; }
/// <summary>
/// 显示名称
/// </summary>
public virtual string DisplayName { get; protected set; }
/// <summary>
/// 平台标识
/// </summary>
public virtual PlatformType PlatformType { get; set; }
/// <summary>
/// 说明
/// </summary>
public virtual string Description { get; set; }
/// <summary>
/// 图标
/// </summary>
public virtual string Icon { get; protected set; }
/// <summary>
/// 路由地址
/// </summary>
public virtual string LinkUrl { get; protected set; }
/// <summary>
/// 是否菜单
/// </summary>
public virtual bool IsMenu { get; set; }
/// <summary>
/// 是否工具栏
/// </summary>
public virtual bool IsToolBar { get; set; }
/// <summary>
/// 是否侧边栏
/// </summary>
public virtual bool IsSideBar { get; set; }
/// <summary>
/// 是否公共路由
/// </summary>
public virtual bool IsPublic { get; set; }
/// <summary>
/// 是否内置
/// </summary>
public virtual bool IsStatic { get; set; }
/// <summary>
/// 总是显示根菜单
/// </summary>
public virtual bool AlwaysShow { get; set; }
/// <summary>
/// 父级标识
/// </summary>
public virtual Guid? ParentId { get; set; }
protected Route()
{
}
public Route(Guid id, string name, string displayName, string url)
{
Id = id;
LinkToUrl(url);
ChangeName(name, displayName);
}
public void LinkToUrl([NotNull] string linkUrl)
{
LinkUrl = Check.NotNullOrWhiteSpace(linkUrl, nameof(linkUrl));
}
public void ChangeIcon(string icon)
{
Icon = icon;
}
public void ChangeName([NotNull] string name, [CanBeNull] string displayName)
{
Name = Check.NotNullOrWhiteSpace(name, nameof(name));
DisplayName = displayName;
}
public static string CreateCode(params int[] numbers)
{
if (numbers.IsNullOrEmpty())
{
return null;
}
return numbers.Select(number => number.ToString(new string('0', RouteConsts.CodeUnitLength))).JoinAsString(".");
}
public static string AppendCode(string parentCode, string childCode)
{
if (childCode.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(childCode), "childCode can not be null or empty.");
}
if (parentCode.IsNullOrEmpty())
{
return childCode;
}
return parentCode + "." + childCode;
}
public static string GetRelativeCode(string code, string parentCode)
{
if (code.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(code), "code can not be null or empty.");
}
if (parentCode.IsNullOrEmpty())
{
return code;
}
if (code.Length == parentCode.Length)
{
return null;
}
return code.Substring(parentCode.Length + 1);
}
public static string CalculateNextCode(string code)
{
if (code.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(code), "code can not be null or empty.");
}
var parentCode = GetParentCode(code);
var lastUnitCode = GetLastUnitCode(code);
return AppendCode(parentCode, CreateCode(Convert.ToInt32(lastUnitCode) + 1));
}
public static string GetLastUnitCode(string code)
{
if (code.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(code), "code can not be null or empty.");
}
var splittedCode = code.Split('.');
return splittedCode[splittedCode.Length - 1];
}
public static string GetParentCode(string code)
{
if (code.IsNullOrEmpty())
{
throw new ArgumentNullException(nameof(code), "code can not be null or empty.");
}
var splittedCode = code.Split('.');
if (splittedCode.Length == 1)
{
return null;
}
return splittedCode.Take(splittedCode.Length - 1).JoinAsString(".");
}
}
}

139
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/RouteManager.cs

@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
using Volo.Abp.Uow;
namespace LINGYUN.Platform.Routes
{
public class RouteManager : DomainService
{
protected IRouteRepository RouteRepository { get; }
public RouteManager(
IRouteRepository routeRepository)
{
RouteRepository = routeRepository;
}
[UnitOfWork]
public virtual async Task CreateAsync(Route route)
{
route.Code = await GetNextChildCodeAsync(route.ParentId);
await RouteRepository.InsertAsync(route);
}
public virtual async Task UpdateAsync(Route route)
{
await RouteRepository.UpdateAsync(route);
}
[UnitOfWork]
public virtual async Task DeleteAsync(Guid id)
{
var children = await FindChildrenAsync(id, true);
foreach (var child in children)
{
await RouteRepository.RemoveAllUsersRouteAsync(child);
await RouteRepository.RemoveAllRolesRouteAsync(child);
await RouteRepository.DeleteAsync(child);
}
var organizationUnit = await RouteRepository.GetAsync(id);
await RouteRepository.RemoveAllUsersRouteAsync(organizationUnit);
await RouteRepository.RemoveAllRolesRouteAsync(organizationUnit);
await RouteRepository.DeleteAsync(id);
}
[UnitOfWork]
public virtual async Task MoveAsync(Guid id, Guid? parentId)
{
var route = await RouteRepository.GetAsync(id);
if (route.ParentId == parentId)
{
return;
}
var children = await FindChildrenAsync(id, true);
var oldCode = route.Code;
route.Code = await GetNextChildCodeAsync(parentId);
route.ParentId = parentId;
foreach (var child in children)
{
child.Code = Route.AppendCode(route.Code, Route.GetRelativeCode(child.Code, oldCode));
}
}
public virtual async Task RemoveRoleFromRouteAsync(string roleName, Route route)
{
await RouteRepository.RemoveRoleRouteAsync(roleName, route);
}
public virtual async Task RemoveUserFromRouteAsync(Guid userId, Route route)
{
await RouteRepository.RemoveUserRouteAsync(userId, route);
}
public virtual async Task<string> GetNextChildCodeAsync(Guid? parentId)
{
var lastChild = await GetLastChildOrNullAsync(parentId);
if (lastChild != null)
{
return Route.CalculateNextCode(lastChild.Code);
}
var parentCode = parentId != null
? await GetCodeOrDefaultAsync(parentId.Value)
: null;
return Route.AppendCode(
parentCode,
Route.CreateCode(1)
);
}
public virtual async Task<Route> GetLastChildOrNullAsync(Guid? parentId)
{
var children = await RouteRepository.GetChildrenAsync(parentId);
return children.OrderBy(c => c.Code).LastOrDefault();
}
public virtual async Task<string> GetCodeOrDefaultAsync(Guid id)
{
var ou = await RouteRepository.GetAsync(id);
return ou?.Code;
}
public async Task<List<Route>> FindChildrenAsync(Guid? parentId, bool recursive = false)
{
if (!recursive)
{
return await RouteRepository.GetChildrenAsync(parentId);
}
if (!parentId.HasValue)
{
return await RouteRepository.GetListAsync();
}
var code = await GetCodeOrDefaultAsync(parentId.Value);
return await RouteRepository.GetAllChildrenWithParentCodeAsync(code, parentId);
}
public virtual async Task<bool> IsInRouteAsync(Guid userId, Route route)
{
return await RouteRepository.IsInRouteAsync(userId, route);
}
public virtual async Task<bool> IsInRouteAsync(string roleName, Route route)
{
return await RouteRepository.IsInRouteAsync(roleName, route);
}
}
}

29
aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/UserRoute.cs

@ -0,0 +1,29 @@
using System;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Routes
{
public class UserRoute : FullAuditedEntity<int>, IMultiTenant
{
public virtual Guid? TenantId { get; protected set; }
public virtual Guid UserId { get; protected set; }
public virtual Guid RouteId { get; protected set; }
protected UserRoute()
{
}
public UserRoute(int id)
{
Id = id;
}
public UserRoute(Guid routeId, Guid userId, Guid? tenantId = null)
{
UserId = userId;
RouteId = routeId;
TenantId = tenantId;
}
}
}

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

@ -0,0 +1,31 @@
using LINGYUN.Platform.Localization;
using LINGYUN.Platform.Versions;
using Volo.Abp.Localization;
using Volo.Abp.Settings;
namespace LINGYUN.Platform.Settings
{
public class PlatformSettingDefinitionProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
context.Add(CreateAppVersionSettings());
}
protected SettingDefinition[] CreateAppVersionSettings()
{
return new SettingDefinition[]
{
new SettingDefinition(PlatformSettingNames.AppVersion.VersionFileLimitLength, AppVersionConsts.DefaultVersionFileLimitLength.ToString(),
L("DisplayName:VersionFileLimitLength"), L("Description:VersionFileLimitLength"), isVisibleToClients: true),
new SettingDefinition(PlatformSettingNames.AppVersion.AllowVersionFileExtensions, AppVersionConsts.DefaultAllowVersionFileExtensions,
L("DisplayName:AllowVersionFileExtensions"), L("Description:AllowVersionFileExtensions"), isVisibleToClients: true),
};
}
protected LocalizableString L(string name)
{
return LocalizableString.Create<PlatformResource>(name);
}
}
}

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

@ -0,0 +1,95 @@
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 ICollection<VersionFile> Files { get; protected set; }
protected AppVersion()
{
Files = new List<VersionFile>();
}
public AppVersion(Guid id, string title, string version, Guid? tenantId = null)
{
Id = id;
Title = title;
Version = version;
TenantId = tenantId;
Level = ImportantLevel.Low;
}
public void AppendFile(string name, string version, long size, string sha256, FileType fileType = FileType.Stream)
{
if (!FileExists(name))
{
Files.Add(new VersionFile(name, version, size, sha256, fileType, TenantId));
}
}
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 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

@ -0,0 +1,21 @@
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(string version, CancellationToken cancellationToken = default);
Task<AppVersion> GetByVersionAsync(string version, CancellationToken cancellationToken = default);
Task<long> GetCountAsync(string filter = "", CancellationToken cancellationToken = default);
Task<List<AppVersion>> GetPagedListAsync(string filter = "", string soring = nameof(AppVersion.CreationTime), bool includeDetails = true, int skipCount = 1, int maxResultCount = 10, CancellationToken cancellationToken = default);
Task<AppVersion> GetLatestVersionAsync(CancellationToken cancellationToken = default);
}
}

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

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

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

@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
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 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)
{
var fileNameWithNotExten = fileName;
// 取出文件扩展名
var fileExten = FileHelper.GetExtension(fileName);
if (!fileExten.IsNullOrWhiteSpace())
{
// 取出不带扩展名的文件名
fileNameWithNotExten = fileName.Replace(fileExten, "");
// 去掉最后一位扩展名符号
fileNameWithNotExten = fileNameWithNotExten.Remove(fileNameWithNotExten.Length - 1);
}
// 转换不受支持的符号
fileNameWithNotExten = fileNameWithNotExten.Replace(".", "-");
// 最终文件名为 应用版本号/文件名(不带扩展名)/文件版本/文件名
// 例: 1.0.0.0/test-upload-text-file/1.0.0.0/test-upload-text-file.text
return $"{appVersion}/{fileNameWithNotExten}/{fileVersion}/{fileName}";
}
}
}

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

@ -0,0 +1,138 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
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 virtual async Task<bool> ExistsAsync(string version)
{
return await VersionRepository.ExistsAsync(version);
}
public virtual async Task<AppVersion> GetByIdAsync(Guid id)
{
return await VersionRepository.GetAsync(id);
}
public virtual async Task<AppVersion> GetByVersionAsync(string version)
{
return await VersionRepository.GetByVersionAsync(version);
}
public virtual async Task<long> GetCountAsync(string filter)
{
return await VersionRepository.GetCountAsync(filter);
}
public virtual async Task<List<AppVersion>> GetPagedListAsync(string filter = "", string soring = nameof(AppVersion.CreationTime), bool includeDetails = true, int skipCount = 1, int maxResultCount = 10)
{
return await VersionRepository.GetPagedListAsync(filter, soring, includeDetails, skipCount, maxResultCount);
}
[UnitOfWork]
public virtual async Task CreateAsync(AppVersion version)
{
await VersionRepository.InsertAsync(version);
}
[UnitOfWork]
public virtual async Task UpdateAsync(AppVersion version)
{
await VersionRepository.UpdateAsync(version);
}
[UnitOfWork]
public virtual async Task DeleteAsync(Guid id)
{
await RemoveAllFileAsync(id);
await VersionRepository.DeleteAsync(id);
}
public virtual async Task<AppVersion> GetLatestAsync()
{
return await VersionRepository.GetLatestVersionAsync();
}
public virtual async Task<Stream> GetFileAsync(string version, string fileName, string fileVersion)
{
return await VersionBlobContainer.GetAsync(
VersionFile.NormalizeBlobName(version, fileName, fileVersion));
}
public virtual async Task<Stream> GetFileAsync(VersionFile versionFile)
{
return await GetFileAsync(versionFile.AppVersion.Version, versionFile.Name, versionFile.Version);
}
public virtual async Task<string> AppendFileAsync(string version, string fileName, string fileVersion, byte[] data)
{
// 计算指纹
var sha256 = new SHA256Managed();
var checkHash = sha256.ComputeHash(data);
var sha256Hash = BitConverter.ToString(checkHash).Replace("-", string.Empty);
await VersionBlobContainer
.SaveAsync(VersionFile.NormalizeBlobName(version, fileName, fileVersion), data, true);
return sha256Hash;
}
[UnitOfWork]
public virtual async Task AppendFileAsync(Guid versionId, string fileSha256,
string fileName, string fileVersion, long fileSize, FileType fileType = FileType.Stream)
{
var appVersion = await VersionRepository.GetAsync(versionId);
if (appVersion.FileExists(fileName))
{
appVersion.RemoveFile(fileName);
}
appVersion.AppendFile(fileName, fileVersion, fileSize, fileSha256, fileType);
}
[UnitOfWork]
public virtual async 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 virtual async 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();
}
}
}

24
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN.Platform.EntityFrameworkCore.csproj

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>3.0.0</Version>
<Authors>LINGYUN</Authors>
<Company />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Platform.Domain\LINGYUN.Platform.Domain.csproj" />
</ItemGroup>
</Project>

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

@ -0,0 +1,15 @@
using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.EntityFrameworkCore
{
[ConnectionStringName(PlatformDbProperties.ConnectionStringName)]
public interface IPlatformDbContext : IEfCoreDbContext
{
DbSet<Route> Routes { get; set; }
DbSet<AppVersion> AppVersions { get; set; }
}
}

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

@ -0,0 +1,29 @@
using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
using Microsoft.EntityFrameworkCore;
using Volo.Abp.Data;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.EntityFrameworkCore
{
[ConnectionStringName(PlatformDbProperties.ConnectionStringName)]
public class PlatformDbContext : AbpDbContext<PlatformDbContext>, IPlatformDbContext
{
public DbSet<Route> Routes { get; set; }
public DbSet<AppVersion> AppVersions { get; set; }
public PlatformDbContext(DbContextOptions<PlatformDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigurePlatform();
}
}
}

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

@ -0,0 +1,138 @@
using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
using Microsoft.EntityFrameworkCore;
using System;
using Volo.Abp;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace LINGYUN.Platform.EntityFrameworkCore
{
public static class PlatformDbContextModelBuilderExtensions
{
public static void ConfigurePlatform(
this ModelBuilder builder,
Action<PlatformModelBuilderConfigurationOptions> optionsAction = null)
{
Check.NotNull(builder, nameof(builder));
var options = new PlatformModelBuilderConfigurationOptions(
PlatformDbProperties.DbTablePrefix,
PlatformDbProperties.DbSchema
);
optionsAction?.Invoke(options);
builder.Entity<Route>(x =>
{
x.ToTable(options.TablePrefix + "Route");
x.Property(p => p.Code)
.IsRequired()
.HasMaxLength(RouteConsts.MaxCodeLength)
.HasColumnName(nameof(Route.Code));
x.Property(p => p.DisplayName)
.IsRequired()
.HasMaxLength(RouteConsts.MaxDisplayNameLength)
.HasColumnName(nameof(Route.DisplayName));
x.Property(p => p.LinkUrl)
.IsRequired()
.HasMaxLength(RouteConsts.MaxLinkUrlLength)
.HasColumnName(nameof(Route.LinkUrl));
x.Property(p => p.Name)
.IsRequired()
.HasMaxLength(RouteConsts.MaxNameLength)
.HasColumnName(nameof(Route.Name));
x.Property(p => p.Icon)
.HasMaxLength(RouteConsts.MaxIconLength)
.HasColumnName(nameof(Route.Icon));
x.Property(p => p.FullName)
.HasMaxLength(RouteConsts.MaxFullNameLength)
.HasColumnName(nameof(Route.FullName));
x.Property(p => p.Description)
.HasMaxLength(RouteConsts.MaxDescriptionLength)
.HasColumnName(nameof(Route.Description));
x.ConfigureByConvention();
x.HasMany<Route>().WithOne().HasForeignKey(p => p.ParentId);
x.HasIndex(i => i.Code);
});
builder.Entity<RoleRoute>(x =>
{
x.ToTable(options.TablePrefix + "RoleRoute");
x.Property(p => p.RoleName)
.IsRequired()
.HasMaxLength(RoleRouteConsts.MaxRoleNameLength)
.HasColumnName(nameof(RoleRoute.RoleName));
x.ConfigureMultiTenant();
x.HasIndex(i => new { i.RoleName, i.RouteId });
});
builder.Entity<UserRoute>(x =>
{
x.ToTable(options.TablePrefix + "UserRoute");
x.ConfigureMultiTenant();
x.HasIndex(i => new { i.UserId, i.RouteId });
});
builder.Entity<AppVersion>(x =>
{
x.ToTable(options.TablePrefix + "Version", options.Schema);
x.Property(p => p.Title)
.IsRequired()
.HasColumnName(nameof(AppVersion.Title))
.HasMaxLength(AppVersionConsts.MaxTitleLength);
x.Property(p => p.Version)
.IsRequired()
.HasColumnName(nameof(AppVersion.Version))
.HasMaxLength(AppVersionConsts.MaxVersionLength);
x.Property(p => p.Description)
.HasColumnName(nameof(AppVersion.Description))
.HasMaxLength(AppVersionConsts.MaxDescriptionLength);
x.ConfigureByConvention();
x.HasIndex(i => i.Version);
x.HasMany(p => p.Files)
.WithOne(q => q.AppVersion)
.HasPrincipalKey(pk => pk.Id)
.HasForeignKey(fk => fk.AppVersionId)
.OnDelete(DeleteBehavior.Cascade);
});
builder.Entity<VersionFile>(x =>
{
x.ToTable(options.TablePrefix + "VersionFile", options.Schema);
x.Property(p => p.Name)
.IsRequired()
.HasColumnName(nameof(VersionFile.Name))
.HasMaxLength(VersionFileConsts.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.ConfigureAudited();
x.ConfigureMultiTenant();
x.HasIndex(i => new { i.Name, i.Version });
});
}
}
}

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

@ -0,0 +1,32 @@
using LINGYUN.Platform.Routes;
using LINGYUN.Platform.Versions;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;
namespace LINGYUN.Platform.EntityFrameworkCore
{
[DependsOn(
typeof(PlatformDomainModule),
typeof(AbpEntityFrameworkCoreModule))]
public class PlatformEntityFrameworkCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAbpDbContext<PlatformDbContext>(options =>
{
options.AddRepository<Route, EfCoreRouteRepository>();
options.AddRepository<AppVersion, EfCoreVersionRepository>();
options.AddDefaultRepositories(includeAllEntities: true);
options.Entity<AppVersion>(appVersion =>
{
appVersion.DefaultWithDetailsFunc = (x) =>
x.Include(q => q.Files);
});
});
}
}
}

18
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs

@ -0,0 +1,18 @@
using JetBrains.Annotations;
using Volo.Abp.EntityFrameworkCore.Modeling;
namespace LINGYUN.Platform.EntityFrameworkCore
{
public class PlatformModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions
{
public PlatformModelBuilderConfigurationOptions(
[NotNull] string tablePrefix = "",
[CanBeNull] string schema = null)
: base(
tablePrefix,
schema)
{
}
}
}

141
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Routes/EfCoreRouteRepository.cs

@ -0,0 +1,141 @@
using LINGYUN.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Routes
{
public class EfCoreRouteRepository : EfCoreRepository<IPlatformDbContext, Route, Guid>, IRouteRepository, ITransientDependency
{
public EfCoreRouteRepository(
IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public virtual async Task<List<Route>> GetAllChildrenWithParentCodeAsync(string code, Guid? parentId, CancellationToken cancellationToken = default)
{
return await DbSet
.Where(ou => ou.Code.StartsWith(code) && ou.Id != parentId.Value)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<Route> GetAsync(string displayName, CancellationToken cancellationToken = default)
{
return await DbSet
.FirstOrDefaultAsync(
ou => ou.DisplayName == displayName,
GetCancellationToken(cancellationToken)
);
}
public virtual async Task<List<Route>> GetChildrenAsync(Guid? parentId, CancellationToken cancellationToken = default)
{
return await DbSet
.Where(x => x.ParentId == parentId)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<Route>> GetPagedListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, CancellationToken cancellationToken = default)
{
return await DbSet
.OrderBy(sorting ?? nameof(Route.Code))
.Page(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<Route>> GetRolesRouteAsync(string roleName, CancellationToken cancellationToken = default)
{
var roleRoutes = await (from route in DbSet
join roleRoute in DbContext.Set<RoleRoute>()
on route.Id equals roleRoute.RouteId
where roleRoute.RoleName.Equals(roleName)
select route)
.ToListAsync(GetCancellationToken(cancellationToken));
return roleRoutes;
}
public virtual async Task<List<Route>> GetUsersRouteAsync(Guid userId, CancellationToken cancellationToken = default)
{
var userRoutes = await (from route in DbSet
join userRoute in DbContext.Set<UserRoute>()
on route.Id equals userRoute.RouteId
where userRoute.UserId.Equals(userId)
select route)
.ToListAsync(GetCancellationToken(cancellationToken));
return userRoutes;
}
public virtual async Task<bool> IsInRouteAsync(string roleName, Route route, CancellationToken cancellationToken = default)
{
return await DbContext.Set<RoleRoute>()
.AnyAsync(x => x.RouteId.Equals(route.Id) && x.RoleName.Equals(roleName),
GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> IsInRouteAsync(Guid userId, Route route, CancellationToken cancellationToken = default)
{
return await DbContext.Set<UserRoute>()
.AnyAsync(x => x.RouteId.Equals(route.Id) && x.UserId.Equals(userId),
GetCancellationToken(cancellationToken));
}
public virtual async Task RemoveAllRolesRouteAsync(Route route, CancellationToken cancellationToken = default)
{
var roleRoutes = await DbContext.Set<RoleRoute>()
.Where(x => x.RouteId.Equals(route.Id))
.Select(x => new RoleRoute(x.Id))
.AsNoTracking()
.ToArrayAsync(GetCancellationToken(cancellationToken));
DbContext.Set<RoleRoute>().AttachRange(roleRoutes);
DbContext.Set<RoleRoute>().RemoveRange(roleRoutes);
}
public virtual async Task RemoveAllUsersRouteAsync(Route route, CancellationToken cancellationToken = default)
{
var userRoutes = await DbContext.Set<UserRoute>()
.Where(x => x.RouteId.Equals(route.Id))
.Select(x => new UserRoute(x.Id))
.AsNoTracking()
.ToArrayAsync(GetCancellationToken(cancellationToken));
DbContext.Set<UserRoute>().AttachRange(userRoutes);
DbContext.Set<UserRoute>().RemoveRange(userRoutes);
}
public virtual async Task RemoveRoleRouteAsync(string roleName, Route route, CancellationToken cancellationToken = default)
{
var roleRoutes = await DbContext.Set<RoleRoute>()
.Where(x => x.RouteId.Equals(route.Id) && x.RoleName.Equals(roleName))
.Select(x => new RoleRoute(x.Id))
.AsNoTracking()
.ToArrayAsync(GetCancellationToken(cancellationToken));
DbContext.Set<RoleRoute>().AttachRange(roleRoutes);
DbContext.Set<RoleRoute>().RemoveRange(roleRoutes);
}
public virtual async Task RemoveUserRouteAsync(Guid userId, Route route, CancellationToken cancellationToken = default)
{
var userRoutes = await DbContext.Set<UserRoute>()
.Where(x => x.RouteId.Equals(route.Id) && x.UserId.Equals(userId))
.Select(x => new UserRoute(x.Id))
.AsNoTracking()
.ToArrayAsync(GetCancellationToken(cancellationToken));
DbContext.Set<UserRoute>().AttachRange(userRoutes);
DbContext.Set<UserRoute>().RemoveRange(userRoutes);
}
}
}

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

@ -0,0 +1,63 @@
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 virtual async Task<long> GetCountAsync(string filter = "", CancellationToken cancellationToken = default)
{
return await DbSet
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Version.Contains(filter) || x.Title.Contains(filter))
.LongCountAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<List<AppVersion>> GetPagedListAsync(string filter = "", string soring = nameof(AppVersion.CreationTime), bool includeDetails = true, int skipCount = 1, int maxResultCount = 10, CancellationToken cancellationToken = default)
{
return await DbSet
.IncludeIf(includeDetails, x => x.Files)
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Version.Contains(filter) || x.Title.Contains(filter))
.OrderBy(soring ?? "") // TODO: 排序待优化
.Page(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<bool> ExistsAsync(string version, CancellationToken cancellationToken = default)
{
return await DbSet
.AnyAsync(x => x.Version.Equals(version), GetCancellationToken(cancellationToken));
}
public virtual async Task<AppVersion> GetByVersionAsync(string version, CancellationToken cancellationToken = default)
{
return await DbSet
.Include(x => x.Files)
.Where(x => x.Version.Equals(version))
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public virtual async Task<AppVersion> GetLatestVersionAsync(CancellationToken cancellationToken = default)
{
return await DbSet
.Include(x => x.Files)
.OrderByDescending(x => x.CreationTime)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
}
}

24
aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN.Platform.HttpApi.csproj

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace />
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>3.0.0</Version>
<Authors>LINGYUN</Authors>
<Company />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>D:\LocalNuget</OutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LINGYUN.Platform.Application.Contracts\LINGYUN.Platform.Application.Contracts.csproj" />
</ItemGroup>
</Project>

17
aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformControllerBase.cs

@ -0,0 +1,17 @@
using LINGYUN.Platform.Localization;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Settings;
namespace LINGYUN.Platform
{
public abstract class PlatformControllerBase : AbpController
{
private ISettingProvider _settingProvider;
protected ISettingProvider SettingProvider => LazyGetRequiredService(ref _settingProvider);
protected PlatformControllerBase()
{
LocalizationResource = typeof(PlatformResource);
}
}
}

31
aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs

@ -0,0 +1,31 @@
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.Modularity;
namespace LINGYUN.Platform.HttpApi
{
[DependsOn(
typeof(PlatformApplicationContractModule),
typeof(AbpAspNetCoreMvcModule))]
public class PlatformHttpApiModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<IMvcBuilder>(mvcBuilder =>
{
mvcBuilder.AddApplicationPartIfNotExists(typeof(PlatformApplicationContractModule).Assembly);
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<FormOptions>(options =>
{
options.ValueLengthLimit = int.MaxValue;
options.MultipartBodyLengthLimit = int.MaxValue;
options.MultipartHeadersLengthLimit = int.MaxValue;
});
}
}
}

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

@ -0,0 +1,217 @@
using LINGYUN.Platform.Settings;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
using System;
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
{
[Area("platform")]
[Route("api/platform/version")]
public class VersionController : PlatformControllerBase
{
private readonly IVersionFileManager _versionFileManager;
private readonly IVersionAppService _versionAppService;
public VersionController(
IVersionAppService versionAppService,
IVersionFileManager versionFileManager)
{
_versionAppService = versionAppService;
_versionFileManager = versionFileManager;
}
[HttpPost]
[Route("file/append")]
public virtual async 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.AppendFileAsync(versionFileCreate.Version,
versionFileCreate.FileName, versionFileCreate.FileVersion, fileData);
}
// 添加到版本信息
await _versionAppService.AppendFileAsync(versionFileCreate);
// 文件保存之后删除临时文件目录
Directory.Delete(tempFilePath, true);
}
}
catch
{
// 发生异常删除临时文件目录
Directory.Delete(tempFilePath, true);
throw;
}
}
[HttpPost]
public virtual async Task<VersionDto> CreateAsync(VersionCreateDto versionCreate)
{
return await _versionAppService.CreateAsync(versionCreate);
}
[HttpDelete]
public virtual async Task DeleteAsync(VersionDeleteDto versionDelete)
{
await _versionAppService.DeleteAsync(versionDelete);
}
[HttpGet]
public virtual async Task<PagedResultDto<VersionDto>> GetAsync(VersionGetByPagedDto versionGetByPaged)
{
return await _versionAppService.GetAsync(versionGetByPaged);
}
[HttpGet]
[Route("{Id}")]
public virtual async Task<VersionDto> GetAsync(VersionGetByIdDto versionGetById)
{
return await _versionAppService.GetAsync(versionGetById);
}
[HttpGet]
[Route("lastest")]
public virtual async Task<VersionDto> GetLastestAsync()
{
return await _versionAppService.GetLastestAsync();
}
[HttpDelete]
[Route("file/clean")]
public virtual async Task RemoveAllFileAsync(VersionGetByIdDto versionGetById)
{
await _versionAppService.RemoveAllFileAsync(versionGetById);
}
[HttpDelete]
[Route("file/remove")]
public virtual async Task RemoveFileAsync(VersionFileDeleteDto versionFileDelete)
{
await _versionAppService.RemoveFileAsync(versionFileDelete);
}
[HttpGet]
[Route("file/download")]
public virtual async Task DownloadFileAsync(VersionFileGetDto versionFileGet)
{
// 分块模式下载文件
// 得到文件流
var fileStream = await _versionFileManager.GetFileAsync(
versionFileGet.Version, 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();
}
}
}
}
}

4
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/.gitignore

@ -0,0 +1,4 @@
bin
obj
Logs
appsettings.*.json

257
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs

@ -0,0 +1,257 @@
using DotNetCore.CAP;
using IdentityModel;
using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.IdentityServer;
using LINGYUN.Abp.Location.Tencent;
using LINGYUN.Abp.MessageService;
using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.TenantManagement;
using LINGYUN.ApiGateway;
using LINGYUN.BackendAdmin.MultiTenancy;
using LINYUN.Abp.Sms.Aliyun;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Text;
using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac;
using Volo.Abp.Caching;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Identity.Localization;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.HttpApi;
using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.PermissionManagement.IdentityServer;
using Volo.Abp.Security.Claims;
using Volo.Abp.Security.Encryption;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.BackendAdmin
{
[DependsOn(
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpPermissionManagementDomainIdentityServerModule),
typeof(ApiGatewayApplicationContractsModule),
typeof(AbpMessageServiceApplicationContractsModule),
typeof(AbpIdentityHttpApiModule),
typeof(AbpIdentityApplicationModule),
typeof(Abp.Account.AbpAccountApplicationModule),
typeof(Abp.Account.AbpAccountHttpApiModule),
typeof(AbpAccountApplicationModule),
typeof(AbpAccountHttpApiModule),
typeof(AbpIdentityServerApplicationModule),
typeof(AbpIdentityServerHttpApiModule),
typeof(AbpSettingManagementApplicationModule),
typeof(AbpSettingManagementHttpApiModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpTenantManagementApplicationModule),
typeof(AbpTenantManagementHttpApiModule),
typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpIdentityServerEntityFrameworkCoreModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpEmailingExceptionHandlingModule),
typeof(AbpCAPEventBusModule),
typeof(AbpAliyunSmsModule),
#if DEBUG
typeof(AbpTencentLocationModule),
#endif
typeof(AbpAutofacModule)
)]
public class BackendAdminHostModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
PreConfigure<CapOptions>(options =>
{
options
.UseMySql(configuration.GetConnectionString("Default"))
.UseRabbitMQ(rabbitMQOptions =>
{
configuration.GetSection("CAP:RabbitMQ").Bind(rabbitMQOptions);
})
.UseDashboard();
});
PreConfigure<IdentityBuilder>(builder =>
{
builder.AddDefaultTokenProviders();
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = hostingEnvironment.BuildConfiguration();
// 配置Ef
Configure<AbpDbContextOptions>(options =>
{
options.UseMySQL();
});
// 加解密
Configure<AbpStringEncryptionOptions>(options =>
{
options.DefaultPassPhrase = "s46c5q55nxpeS8Ra";
options.InitVectorBytes = Encoding.ASCII.GetBytes("s83ng0abvd02js84");
options.DefaultSalt = Encoding.ASCII.GetBytes("sf&5)s3#");
});
Configure<PermissionManagementOptions>(options =>
{
// Rename IdentityServer.Client.ManagePermissions
// See https://github.com/abpframework/abp/blob/dev/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo/Abp/PermissionManagement/IdentityServer/AbpPermissionManagementDomainIdentityServerModule.cs
options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = AbpIdentityServerPermissions.Clients.ManagePermissions;
});
// 自定义需要处理的异常
Configure<AbpExceptionHandlingOptions>(options =>
{
// 加入需要处理的异常类型
options.Handlers.Add<AbpException>();
});
// 自定义需要发送邮件通知的异常类型
Configure<AbpEmailExceptionHandlingOptions>(options =>
{
// 是否发送堆栈信息
options.SendStackTrace = true;
// 未指定异常接收者的默认接收邮件
options.DefaultReceiveEmail = "colin.in@foxmail.com";
// 指定某种异常发送到哪个邮件
options.HandReceivedException<AbpException>("colin.in@foxmail.com");
});
Configure<AbpDistributedCacheOptions>(options =>
{
// 滑动过期30天
options.GlobalCacheEntryOptions.SlidingExpiration = TimeSpan.FromDays(30);
// 绝对过期60天
options.GlobalCacheEntryOptions.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(60);
});
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<BackendAdminHostModule>("LINGYUN.BackendAdmin");
});
// 多租户
Configure<AbpMultiTenancyOptions>(options =>
{
options.IsEnabled = true;
});
Configure<AbpTenantResolveOptions>(options =>
{
options.TenantResolvers.Insert(0, new AuthorizationTenantResolveContributor());
});
// Swagger
context.Services.AddSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "BackendAdmin API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
});
// 支持本地化语言类型
Configure<AbpLocalizationOptions>(options =>
{
options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
options.Resources
.Get<IdentityResource>()
.AddVirtualJson("/LINGYUN/BackendAdmin/Identity/Localization");
});
context.Services.AddAuthentication("Bearer")
.AddIdentityServerAuthentication(options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = false;
options.ApiName = configuration["AuthServer:ApiName"];
AbpClaimTypes.UserId = JwtClaimTypes.Subject;
AbpClaimTypes.UserName = JwtClaimTypes.Name;
AbpClaimTypes.Role = JwtClaimTypes.Role;
AbpClaimTypes.Email = JwtClaimTypes.Email;
});
context.Services.AddStackExchangeRedisCache(options =>
{
options.Configuration = configuration["RedisCache:ConnectString"];
var instanceName = configuration["RedisCache:RedisPrefix"];
options.InstanceName = instanceName.IsNullOrEmpty() ? "BackendAdmin_Cache" : instanceName;
});
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["RedisCache:ConnectString"]);
context.Services
.AddDataProtection()
.PersistKeysToStackExchangeRedis(redis, "BackendAdmin-Protection-Keys");
}
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
// http调用链
app.UseCorrelationId();
// 虚拟文件系统
app.UseVirtualFiles();
// 本地化
app.UseAbpRequestLocalization();
//路由
app.UseRouting();
// 认证
app.UseAuthentication();
// jwt
app.UseJwtTokenMiddleware();
// 多租户
app.UseMultiTenancy();
// Swagger
app.UseSwagger();
// Swagger可视化界面
app.UseSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support BackendAdmin API");
});
// 审计日志
app.UseAuditing();
// 路由
app.UseConfiguredEndpoints();
}
}
}

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Controllers/LocationController.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Controllers/LocationController.cs

@ -4,7 +4,7 @@ using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
#if DEBUG #if DEBUG
namespace LINGYUN.Platform.Controllers namespace LINGYUN.BackendAdmin.Controllers
{ {
[Route("Location")] [Route("Location")]
public class LocationController : AbpController public class LocationController : AbpController

31
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContext.cs

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace LINGYUN.BackendAdmin.EntityFrameworkCore
{
public class BackendAdminHostMigrationsDbContext : AbpDbContext<BackendAdminHostMigrationsDbContext>
{
public BackendAdminHostMigrationsDbContext(DbContextOptions<BackendAdminHostMigrationsDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.UseMySQL();
modelBuilder.ConfigureIdentity();
modelBuilder.ConfigureIdentityServer();
//modelBuilder.ConfigureTenantManagement();
//modelBuilder.ConfigureSettingManagement();
//modelBuilder.ConfigurePermissionManagement();
}
}
}

29
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/BackendAdminHostMigrationsDbContextFactory.cs

@ -0,0 +1,29 @@
using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
namespace LINGYUN.BackendAdmin.EntityFrameworkCore
{
public class BackendAdminHostMigrationsDbContextFactory : IDesignTimeDbContextFactory<BackendAdminHostMigrationsDbContext>
{
public BackendAdminHostMigrationsDbContext CreateDbContext(string[] args)
{
var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<BackendAdminHostMigrationsDbContext>()
.UseMySql(configuration.GetConnectionString("AbpIdentityServer"));
return new BackendAdminHostMigrationsDbContext(builder.Options);
}
private static IConfigurationRoot BuildConfiguration()
{
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.Development.json", optional: false);
return builder.Build();
}
}
}

0
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EntityFrameworkCore/Identity/EfCoreIdentityUserExtensionRepository.cs

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantConnectionStringCreateEventHandler.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EventBus/Handlers/TenantConnectionStringCreateEventHandler.cs

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace LINGYUN.Platform.EventBus.Handlers namespace LINGYUN.BackendAdmin.EventBus.Handlers
{ {
public class TenantConnectionStringCreateEventHandler public class TenantConnectionStringCreateEventHandler
{ {

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantCreateEventHandler.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EventBus/Handlers/TenantCreateEventHandler.cs

@ -13,7 +13,7 @@ using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement; using Volo.Abp.PermissionManagement;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace LINGYUN.Platform.EventBus.Handlers namespace LINGYUN.BackendAdmin.EventBus.Handlers
{ {
public class TenantCreateEventHandler : IDistributedEventHandler<CreateEventData>, ITransientDependency public class TenantCreateEventHandler : IDistributedEventHandler<CreateEventData>, ITransientDependency
{ {

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EventBus/Handlers/TenantDeleteEventHandler.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/EventBus/Handlers/TenantDeleteEventHandler.cs

@ -12,7 +12,7 @@ using Volo.Abp.PermissionManagement;
using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement;
using Volo.Abp.Uow; using Volo.Abp.Uow;
namespace LINGYUN.Platform.EventBus.Handlers namespace LINGYUN.BackendAdmin.EventBus.Handlers
{ {
public class TenantDeleteEventHandler : IDistributedEventHandler<EntityDeletedEto<TenantEto>>, ITransientDependency public class TenantDeleteEventHandler : IDistributedEventHandler<EntityDeletedEto<TenantEto>>, ITransientDependency
{ {

83
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj

@ -0,0 +1,83 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>LINGYUN.BackendAdmin</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Migrations\20200606010914_Upgrade-Abp-3.0.0.cs" />
<Compile Remove="Migrations\20200606010914_Upgrade-Abp-3.0.0.Designer.cs" />
<Compile Remove="Migrations\20200606011507_Upgrade-Abp-3.0.0.cs" />
<Compile Remove="Migrations\20200606011507_Upgrade-Abp-3.0.0.Designer.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="LINGYUN\BackendAdmin\Identity\Localization\en.json" />
<Content Remove="LINGYUN\BackendAdmin\Identity\Localization\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\BackendAdmin\Identity\Localization\en.json" />
<EmbeddedResource Include="LINGYUN\BackendAdmin\Identity\Localization\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotNetCore.CAP.Dashboard" Version="3.0.4" />
<PackageReference Include="DotNetCore.CAP.MySql" Version="3.0.4" />
<PackageReference Include="DotNetCore.CAP.RabbitMQ" Version="3.0.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="3.1.4" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="3.1.4" />
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Enrichers.Assembly" Version="2.0.0" />
<PackageReference Include="Serilog.Enrichers.Process" Version="2.0.1" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="3.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Account.Application" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\modules\account\LINGYUN.Abp.Account.Application\LINGYUN.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\modules\account\LINGYUN.Abp.Account.HttpApi\LINGYUN.Abp.Account.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\apigateway\LINGYUN.ApiGateway.Application.Contracts\LINGYUN.ApiGateway.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.Location.Tencent\LINGYUN.Abp.Location.Tencent.csproj" />
<ProjectReference Include="..\..\..\modules\message\LINGYUN.Abp.MessageService.Application.Contracts\LINGYUN.Abp.MessageService.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" />
<ProjectReference Include="..\..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.Application\LINGYUN.Abp.IdentityServer.Application.csproj" />
<ProjectReference Include="..\..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.HttpApi\LINGYUN.Abp.IdentityServer.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.SmsValidator\LINGYUN.Abp.IdentityServer.SmsValidator.csproj" />
<ProjectReference Include="..\..\..\modules\settings\LINGYUN.Abp.SettingManagement.Application\LINGYUN.Abp.SettingManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\settings\LINGYUN.Abp.SettingManagement.HttpApi\LINGYUN.Abp.SettingManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\tenants\LINGYUN.Abp.TenantManagement.Application\LINGYUN.Abp.TenantManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\tenants\LINGYUN.Abp.TenantManagement.HttpApi\LINGYUN.Abp.TenantManagement.HttpApi.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="SignalR\" />
</ItemGroup>
</Project>

0
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN/Platform/Identity/Localization/en.json → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN/BackendAdmin/Identity/Localization/en.json

0
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN/Platform/Identity/Localization/zh-Hans.json → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN/BackendAdmin/Identity/Localization/zh-Hans.json

6
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.Designer.cs

@ -1,13 +1,13 @@
// <auto-generated /> // <auto-generated />
using LINGYUN.Platform.EntityFrameworkCore; using LINGYUN.BackendAdmin.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using System; using System;
namespace LINGYUN.Platform.Migrations namespace LINGYUN.BackendAdmin.Migrations
{ {
[DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] [DbContext(typeof(BackendAdminHostMigrationsDbContext))]
[Migration("20200513010936_Migration-IdentityServer-MySql")] [Migration("20200513010936_Migration-IdentityServer-MySql")]
partial class MigrationIdentityServerMySql partial class MigrationIdentityServerMySql
{ {

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200513010936_Migration-IdentityServer-MySql.cs

@ -1,7 +1,7 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace LINGYUN.Platform.Migrations namespace LINGYUN.BackendAdmin.Migrations
{ {
public partial class MigrationIdentityServerMySql : Migration public partial class MigrationIdentityServerMySql : Migration
{ {

6
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.Designer.cs

@ -1,15 +1,15 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using LINGYUN.Platform.EntityFrameworkCore; using LINGYUN.BackendAdmin.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Migrations namespace LINGYUN.BackendAdmin.Migrations
{ {
[DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] [DbContext(typeof(BackendAdminHostMigrationsDbContext))]
[Migration("20200606012143_Upgrade-Abp-3.0.0")] [Migration("20200606012143_Upgrade-Abp-3.0.0")]
partial class UpgradeAbp290 partial class UpgradeAbp290
{ {

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/20200606012143_Upgrade-Abp-2.9.0.cs

@ -1,7 +1,7 @@
using System; using System;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;
namespace LINGYUN.Platform.Migrations namespace LINGYUN.BackendAdmin.Migrations
{ {
public partial class UpgradeAbp290 : Migration public partial class UpgradeAbp290 : Migration
{ {

6
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Migrations/IdentityServerMigrationsDbContextModelSnapshot.cs

@ -1,14 +1,14 @@
// <auto-generated /> // <auto-generated />
using System; using System;
using LINGYUN.Platform.EntityFrameworkCore; using LINGYUN.BackendAdmin.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Migrations namespace LINGYUN.BackendAdmin.Migrations
{ {
[DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))] [DbContext(typeof(BackendAdminHostMigrationsDbContext))]
partial class IdentityServerMigrationsDbContextModelSnapshot : ModelSnapshot partial class IdentityServerMigrationsDbContextModelSnapshot : ModelSnapshot
{ {
protected override void BuildModel(ModelBuilder modelBuilder) protected override void BuildModel(ModelBuilder modelBuilder)

35
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/MultiTenancy/AuthorizationTenantResolveContributor.cs

@ -0,0 +1,35 @@
using Microsoft.AspNetCore.Http;
using System.Linq;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Security.Claims;
namespace LINGYUN.BackendAdmin.MultiTenancy
{
public class AuthorizationTenantResolveContributor : HttpTenantResolveContributorBase
{
public override string Name => "Authorization";
protected override string GetTenantIdOrNameFromHttpContextOrNull(ITenantResolveContext context, HttpContext httpContext)
{
if (httpContext.User?.Identity == null)
{
return null;
}
if (!httpContext.User.Identity.IsAuthenticated)
{
return null;
}
var tenantIdKey = context.GetAbpAspNetCoreMultiTenancyOptions().TenantKey;
var tenantClaim = httpContext.User.Claims.FirstOrDefault(x => x.Type.Equals(AbpClaimTypes.TenantId));
if (tenantClaim == null)
{
return null;
}
return tenantClaim.Value;
}
}
}

49
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Program.cs

@ -0,0 +1,49 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Serilog;
using System;
using System.IO;
namespace LINGYUN.BackendAdmin
{
public class Program
{
public static int Main(string[] args)
{
var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production";
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile($"appsettings.{env}.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.CreateLogger();
try
{
Log.Information("Starting web host.");
CreateHostBuilder(args).Build().Run();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, "Host terminated unexpectedly!");
return 1;
}
finally
{
Log.CloseAndFlush();
}
}
internal static IHostBuilder CreateHostBuilder(string[] args) =>
Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.UseSerilog()
.UseAutofac();
}
}

20
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Properties/launchSettings.json

@ -0,0 +1,20 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:54521",
"sslPort": 0
}
},
"profiles": {
"LINGYUN.BackendAdminApp.Host": {
"commandName": "Project",
"launchBrowser": false,
"applicationUrl": "http://localhost:30010",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

18
aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/Startup.cs

@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace LINGYUN.BackendAdmin
{
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddApplication<BackendAdminHostModule>();
}
public void Configure(IApplicationBuilder app)
{
app.InitializeApplication();
}
}
}

0
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/tempkey.rsa → aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/tempkey.rsa

6
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/.gitignore

@ -1,4 +1,2 @@
bin .vs
obj file-blob-storing
Logs
appsettings.*.json

16
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContext.cs

@ -1,10 +1,5 @@
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore;
namespace LINGYUN.Platform.EntityFrameworkCore namespace LINGYUN.Platform.EntityFrameworkCore
{ {
@ -20,16 +15,7 @@ namespace LINGYUN.Platform.EntityFrameworkCore
{ {
base.OnModelCreating(modelBuilder); base.OnModelCreating(modelBuilder);
modelBuilder.UseMySQL(); modelBuilder.ConfigurePlatform();
modelBuilder.ConfigureIdentity();
modelBuilder.ConfigureIdentityServer(options =>
{
options.TablePrefix = "IdentityServer";
options.Schema = null;
});
//modelBuilder.ConfigureTenantManagement();
//modelBuilder.ConfigureSettingManagement();
//modelBuilder.ConfigurePermissionManagement();
} }
} }
} }

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/EntityFrameworkCore/PlatformHttpApiHostMigrationsDbContextFactory.cs

@ -12,7 +12,7 @@ namespace LINGYUN.Platform.EntityFrameworkCore
var configuration = BuildConfiguration(); var configuration = BuildConfiguration();
var builder = new DbContextOptionsBuilder<PlatformHttpApiHostMigrationsDbContext>() var builder = new DbContextOptionsBuilder<PlatformHttpApiHostMigrationsDbContext>()
.UseMySql(configuration.GetConnectionString("AbpIdentityServer")); .UseMySql(configuration.GetConnectionString("Default"));
return new PlatformHttpApiHostMigrationsDbContext(builder.Options); return new PlatformHttpApiHostMigrationsDbContext(builder.Options);
} }

51
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/LINGYUN.Platform.HttpApi.Host.csproj

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
@ -6,20 +6,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Remove="Migrations\20200606010914_Upgrade-Abp-3.0.0.cs" /> <Compile Remove="Migrations\20200723131720_Add-Platform-Module.cs" />
<Compile Remove="Migrations\20200606010914_Upgrade-Abp-3.0.0.Designer.cs" /> <Compile Remove="Migrations\20200723131720_Add-Platform-Module.Designer.cs" />
<Compile Remove="Migrations\20200606011507_Upgrade-Abp-3.0.0.cs" />
<Compile Remove="Migrations\20200606011507_Upgrade-Abp-3.0.0.Designer.cs" />
</ItemGroup>
<ItemGroup>
<Content Remove="LINGYUN\Platform\Identity\Localization\en.json" />
<Content Remove="LINGYUN\Platform\Identity\Localization\zh-Hans.json" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="LINGYUN\Platform\Identity\Localization\en.json" />
<EmbeddedResource Include="LINGYUN\Platform\Identity\Localization\zh-Hans.json" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -40,44 +28,23 @@
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" /> <PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" /> <PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" /> <PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="3.0.0" /> <PackageReference Include="Volo.Abp.AspNetCore.MultiTenancy" Version="3.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="3.0.0" /> <PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="3.0.0" /> <PackageReference Include="Volo.Abp.Autofac" Version="3.0.0" />
<PackageReference Include="Volo.Abp.BlobStoring.FileSystem" Version="3.0.0" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="3.0.0" /> <PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Account.Application" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.IdentityServer" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="3.0.0" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.IdentityServer.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="3.0.0" /> <PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="3.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\modules\account\LINGYUN.Abp.Account.Application\LINGYUN.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\modules\account\LINGYUN.Abp.Account.HttpApi\LINGYUN.Abp.Account.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\apigateway\LINGYUN.ApiGateway.Application.Contracts\LINGYUN.ApiGateway.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" /> <ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.EventBus.CAP\LINGYUN.Abp.EventBus.CAP.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" /> <ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.ExceptionHandling.Emailing\LINGYUN.Abp.ExceptionHandling.Emailing.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.Location.Tencent\LINGYUN.Abp.Location.Tencent.csproj" /> <ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.Notifications\LINGYUN.Abp.Notifications.csproj" />
<ProjectReference Include="..\..\..\modules\message\LINGYUN.Abp.MessageService.Application.Contracts\LINGYUN.Abp.MessageService.Application.Contracts.csproj" /> <ProjectReference Include="..\..\..\modules\platform\LINGYUN.Platform.Application\LINGYUN.Platform.Application.csproj" />
<ProjectReference Include="..\..\..\modules\common\LINGYUN.Abp.Sms.Aliyun\LINGYUN.Abp.Sms.Aliyun.csproj" /> <ProjectReference Include="..\..\..\modules\platform\LINGYUN.Platform.EntityFrameworkCore\LINGYUN.Platform.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.Application\LINGYUN.Abp.IdentityServer.Application.csproj" /> <ProjectReference Include="..\..\..\modules\platform\LINGYUN.Platform.HttpApi\LINGYUN.Platform.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.HttpApi\LINGYUN.Abp.IdentityServer.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\identityServer\LINGYUN.Abp.IdentityServer.SmsValidator\LINGYUN.Abp.IdentityServer.SmsValidator.csproj" />
<ProjectReference Include="..\..\..\modules\settings\LINGYUN.Abp.SettingManagement.Application\LINGYUN.Abp.SettingManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\settings\LINGYUN.Abp.SettingManagement.HttpApi\LINGYUN.Abp.SettingManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\tenants\LINGYUN.Abp.TenantManagement.Application\LINGYUN.Abp.TenantManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\tenants\LINGYUN.Abp.TenantManagement.HttpApi\LINGYUN.Abp.TenantManagement.HttpApi.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="SignalR\" />
</ItemGroup> </ItemGroup>
</Project> </Project>

397
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723133732_Add-Platform-Module.Designer.cs

@ -0,0 +1,397 @@
// <auto-generated />
using System;
using LINGYUN.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Migrations
{
[DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))]
[Migration("20200723133732_Add-Platform-Module")]
partial class AddPlatformModule
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "3.1.5")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Platform.Routes.RoleRoute", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<bool>("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("RoleName")
.IsRequired()
.HasColumnName("RoleName")
.HasColumnType("varchar(256) CHARACTER SET utf8mb4")
.HasMaxLength(256);
b.Property<Guid>("RouteId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("RoleName", "RouteId");
b.ToTable("AppPlatformRoleRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<bool>("AlwaysShow")
.HasColumnType("tinyint(1)");
b.Property<string>("Code")
.IsRequired()
.HasColumnName("Code")
.HasColumnType("varchar(95) CHARACTER SET utf8mb4")
.HasMaxLength(95);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnName("DisplayName")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<string>("FullName")
.HasColumnName("FullName")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("Icon")
.HasColumnName("Icon")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("tinyint(1)")
.HasDefaultValue(false);
b.Property<bool>("IsMenu")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsPublic")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSideBar")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsStatic")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsToolBar")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("LinkUrl")
.IsRequired()
.HasColumnName("LinkUrl")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("varchar(64) CHARACTER SET utf8mb4")
.HasMaxLength(64);
b.Property<Guid?>("ParentId")
.HasColumnType("char(36)");
b.Property<int>("PlatformType")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("Code");
b.HasIndex("ParentId");
b.ToTable("AppPlatformRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.UserRoute", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<bool>("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)");
b.Property<Guid>("RouteId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("UserId", "RouteId");
b.ToTable("AppPlatformUserRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("longtext CHARACTER SET utf8mb4")
.HasMaxLength(2048);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("tinyint(1)")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<int>("Level")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasColumnType("varchar(50) CHARACTER SET utf8mb4")
.HasMaxLength(50);
b.Property<string>("Version")
.IsRequired()
.HasColumnName("Version")
.HasColumnType("varchar(20) CHARACTER SET utf8mb4")
.HasMaxLength(20);
b.HasKey("Id");
b.HasIndex("Version");
b.ToTable("AppPlatformVersion");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<Guid>("AppVersionId")
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<int>("DownloadCount")
.HasColumnType("int");
b.Property<int>("FileType")
.HasColumnType("int");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("SHA256")
.IsRequired()
.HasColumnName("SHA256")
.HasColumnType("varchar(32) CHARACTER SET utf8mb4")
.HasMaxLength(32);
b.Property<long>("Size")
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Version")
.IsRequired()
.HasColumnName("Version")
.HasColumnType("varchar(20) CHARACTER SET utf8mb4")
.HasMaxLength(20);
b.HasKey("Id");
b.HasIndex("AppVersionId");
b.HasIndex("Name", "Version");
b.ToTable("AppPlatformVersionFile");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b =>
{
b.HasOne("LINGYUN.Platform.Routes.Route", null)
.WithMany()
.HasForeignKey("ParentId");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b =>
{
b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion")
.WithMany("Files")
.HasForeignKey("AppVersionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

206
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723133732_Add-Platform-Module.cs

@ -0,0 +1,206 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace LINGYUN.Platform.Migrations
{
public partial class AddPlatformModule : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AppPlatformRoleRoute",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
RoleName = table.Column<string>(maxLength: 256, nullable: false),
RouteId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppPlatformRoleRoute", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AppPlatformRoute",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
Code = table.Column<string>(maxLength: 95, nullable: false),
Name = table.Column<string>(maxLength: 64, nullable: false),
FullName = table.Column<string>(maxLength: 128, nullable: true),
DisplayName = table.Column<string>(maxLength: 128, nullable: false),
PlatformType = table.Column<int>(nullable: false),
Description = table.Column<string>(maxLength: 255, nullable: true),
Icon = table.Column<string>(maxLength: 128, nullable: true),
LinkUrl = table.Column<string>(maxLength: 255, nullable: false),
IsMenu = table.Column<bool>(nullable: false),
IsToolBar = table.Column<bool>(nullable: false),
IsSideBar = table.Column<bool>(nullable: false),
IsPublic = table.Column<bool>(nullable: false),
IsStatic = table.Column<bool>(nullable: false),
AlwaysShow = table.Column<bool>(nullable: false),
ParentId = table.Column<Guid>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AppPlatformRoute", x => x.Id);
table.ForeignKey(
name: "FK_AppPlatformRoute_AppPlatformRoute_ParentId",
column: x => x.ParentId,
principalTable: "AppPlatformRoute",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "AppPlatformUserRoute",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
UserId = table.Column<Guid>(nullable: false),
RouteId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppPlatformUserRoute", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AppPlatformVersion",
columns: table => new
{
Id = table.Column<Guid>(nullable: false),
ExtraProperties = table.Column<string>(nullable: true),
ConcurrencyStamp = table.Column<string>(maxLength: 40, nullable: true),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
IsDeleted = table.Column<bool>(nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(nullable: true),
DeletionTime = table.Column<DateTime>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
Title = table.Column<string>(maxLength: 50, nullable: false),
Version = table.Column<string>(maxLength: 20, nullable: false),
Description = table.Column<string>(maxLength: 2048, nullable: true),
Level = table.Column<int>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppPlatformVersion", x => x.Id);
});
migrationBuilder.CreateTable(
name: "AppPlatformVersionFile",
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
CreationTime = table.Column<DateTime>(nullable: false),
CreatorId = table.Column<Guid>(nullable: true),
LastModificationTime = table.Column<DateTime>(nullable: true),
LastModifierId = table.Column<Guid>(nullable: true),
TenantId = table.Column<Guid>(nullable: true),
Name = table.Column<string>(maxLength: 255, nullable: false),
Version = table.Column<string>(maxLength: 20, nullable: false),
Size = table.Column<long>(nullable: false),
FileType = table.Column<int>(nullable: false),
SHA256 = table.Column<string>(maxLength: 32, nullable: false),
DownloadCount = table.Column<int>(nullable: false),
AppVersionId = table.Column<Guid>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AppPlatformVersionFile", x => x.Id);
table.ForeignKey(
name: "FK_AppPlatformVersionFile_AppPlatformVersion_AppVersionId",
column: x => x.AppVersionId,
principalTable: "AppPlatformVersion",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AppPlatformRoleRoute_RoleName_RouteId",
table: "AppPlatformRoleRoute",
columns: new[] { "RoleName", "RouteId" });
migrationBuilder.CreateIndex(
name: "IX_AppPlatformRoute_Code",
table: "AppPlatformRoute",
column: "Code");
migrationBuilder.CreateIndex(
name: "IX_AppPlatformRoute_ParentId",
table: "AppPlatformRoute",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_AppPlatformUserRoute_UserId_RouteId",
table: "AppPlatformUserRoute",
columns: new[] { "UserId", "RouteId" });
migrationBuilder.CreateIndex(
name: "IX_AppPlatformVersion_Version",
table: "AppPlatformVersion",
column: "Version");
migrationBuilder.CreateIndex(
name: "IX_AppPlatformVersionFile_AppVersionId",
table: "AppPlatformVersionFile",
column: "AppVersionId");
migrationBuilder.CreateIndex(
name: "IX_AppPlatformVersionFile_Name_Version",
table: "AppPlatformVersionFile",
columns: new[] { "Name", "Version" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AppPlatformRoleRoute");
migrationBuilder.DropTable(
name: "AppPlatformRoute");
migrationBuilder.DropTable(
name: "AppPlatformUserRoute");
migrationBuilder.DropTable(
name: "AppPlatformVersionFile");
migrationBuilder.DropTable(
name: "AppPlatformVersion");
}
}
}

397
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723143103_Modify-Version-File-SHA256-Length.Designer.cs

@ -0,0 +1,397 @@
// <auto-generated />
using System;
using LINGYUN.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Migrations
{
[DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))]
[Migration("20200723143103_Modify-Version-File-SHA256-Length")]
partial class ModifyVersionFileSHA256Length
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "3.1.5")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Platform.Routes.RoleRoute", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<bool>("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("RoleName")
.IsRequired()
.HasColumnName("RoleName")
.HasColumnType("varchar(256) CHARACTER SET utf8mb4")
.HasMaxLength(256);
b.Property<Guid>("RouteId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("RoleName", "RouteId");
b.ToTable("AppPlatformRoleRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<bool>("AlwaysShow")
.HasColumnType("tinyint(1)");
b.Property<string>("Code")
.IsRequired()
.HasColumnName("Code")
.HasColumnType("varchar(95) CHARACTER SET utf8mb4")
.HasMaxLength(95);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnName("DisplayName")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<string>("FullName")
.HasColumnName("FullName")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("Icon")
.HasColumnName("Icon")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("tinyint(1)")
.HasDefaultValue(false);
b.Property<bool>("IsMenu")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsPublic")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSideBar")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsStatic")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsToolBar")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("LinkUrl")
.IsRequired()
.HasColumnName("LinkUrl")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("varchar(64) CHARACTER SET utf8mb4")
.HasMaxLength(64);
b.Property<Guid?>("ParentId")
.HasColumnType("char(36)");
b.Property<int>("PlatformType")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("Code");
b.HasIndex("ParentId");
b.ToTable("AppPlatformRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.UserRoute", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<bool>("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)");
b.Property<Guid>("RouteId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("UserId", "RouteId");
b.ToTable("AppPlatformUserRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("longtext CHARACTER SET utf8mb4")
.HasMaxLength(2048);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("tinyint(1)")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<int>("Level")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasColumnType("varchar(50) CHARACTER SET utf8mb4")
.HasMaxLength(50);
b.Property<string>("Version")
.IsRequired()
.HasColumnName("Version")
.HasColumnType("varchar(20) CHARACTER SET utf8mb4")
.HasMaxLength(20);
b.HasKey("Id");
b.HasIndex("Version");
b.ToTable("AppPlatformVersion");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<Guid>("AppVersionId")
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<int>("DownloadCount")
.HasColumnType("int");
b.Property<int>("FileType")
.HasColumnType("int");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("SHA256")
.IsRequired()
.HasColumnName("SHA256")
.HasColumnType("varchar(65) CHARACTER SET utf8mb4")
.HasMaxLength(65);
b.Property<long>("Size")
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Version")
.IsRequired()
.HasColumnName("Version")
.HasColumnType("varchar(20) CHARACTER SET utf8mb4")
.HasMaxLength(20);
b.HasKey("Id");
b.HasIndex("AppVersionId");
b.HasIndex("Name", "Version");
b.ToTable("AppPlatformVersionFile");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b =>
{
b.HasOne("LINGYUN.Platform.Routes.Route", null)
.WithMany()
.HasForeignKey("ParentId");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b =>
{
b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion")
.WithMany("Files")
.HasForeignKey("AppVersionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

31
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/20200723143103_Modify-Version-File-SHA256-Length.cs

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace LINGYUN.Platform.Migrations
{
public partial class ModifyVersionFileSHA256Length : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SHA256",
table: "AppPlatformVersionFile",
maxLength: 65,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(32) CHARACTER SET utf8mb4",
oldMaxLength: 32);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SHA256",
table: "AppPlatformVersionFile",
type: "varchar(32) CHARACTER SET utf8mb4",
maxLength: 32,
nullable: false,
oldClrType: typeof(string),
oldMaxLength: 65);
}
}
}

395
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Migrations/PlatformHttpApiHostMigrationsDbContextModelSnapshot.cs

@ -0,0 +1,395 @@
// <auto-generated />
using System;
using LINGYUN.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Migrations
{
[DbContext(typeof(PlatformHttpApiHostMigrationsDbContext))]
partial class PlatformHttpApiHostMigrationsDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
.HasAnnotation("ProductVersion", "3.1.5")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("LINGYUN.Platform.Routes.RoleRoute", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<bool>("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("RoleName")
.IsRequired()
.HasColumnName("RoleName")
.HasColumnType("varchar(256) CHARACTER SET utf8mb4")
.HasMaxLength(256);
b.Property<Guid>("RouteId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("RoleName", "RouteId");
b.ToTable("AppPlatformRoleRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<bool>("AlwaysShow")
.HasColumnType("tinyint(1)");
b.Property<string>("Code")
.IsRequired()
.HasColumnName("Code")
.HasColumnType("varchar(95) CHARACTER SET utf8mb4")
.HasMaxLength(95);
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("DisplayName")
.IsRequired()
.HasColumnName("DisplayName")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<string>("FullName")
.HasColumnName("FullName")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<string>("Icon")
.HasColumnName("Icon")
.HasColumnType("varchar(128) CHARACTER SET utf8mb4")
.HasMaxLength(128);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("tinyint(1)")
.HasDefaultValue(false);
b.Property<bool>("IsMenu")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsPublic")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsSideBar")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsStatic")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsToolBar")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("LinkUrl")
.IsRequired()
.HasColumnName("LinkUrl")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("varchar(64) CHARACTER SET utf8mb4")
.HasMaxLength(64);
b.Property<Guid?>("ParentId")
.HasColumnType("char(36)");
b.Property<int>("PlatformType")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("Code");
b.HasIndex("ParentId");
b.ToTable("AppPlatformRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.UserRoute", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<bool>("IsDeleted")
.HasColumnType("tinyint(1)");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)");
b.Property<Guid>("RouteId")
.HasColumnType("char(36)");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<Guid>("UserId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("UserId", "RouteId");
b.ToTable("AppPlatformUserRoute");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.AppVersion", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnName("ConcurrencyStamp")
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
.HasMaxLength(40);
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<Guid?>("DeleterId")
.HasColumnName("DeleterId")
.HasColumnType("char(36)");
b.Property<DateTime?>("DeletionTime")
.HasColumnName("DeletionTime")
.HasColumnType("datetime(6)");
b.Property<string>("Description")
.HasColumnName("Description")
.HasColumnType("longtext CHARACTER SET utf8mb4")
.HasMaxLength(2048);
b.Property<string>("ExtraProperties")
.HasColumnName("ExtraProperties")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnName("IsDeleted")
.HasColumnType("tinyint(1)")
.HasDefaultValue(false);
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<int>("Level")
.HasColumnType("int");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Title")
.IsRequired()
.HasColumnName("Title")
.HasColumnType("varchar(50) CHARACTER SET utf8mb4")
.HasMaxLength(50);
b.Property<string>("Version")
.IsRequired()
.HasColumnName("Version")
.HasColumnType("varchar(20) CHARACTER SET utf8mb4")
.HasMaxLength(20);
b.HasKey("Id");
b.HasIndex("Version");
b.ToTable("AppPlatformVersion");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<Guid>("AppVersionId")
.HasColumnType("char(36)");
b.Property<DateTime>("CreationTime")
.HasColumnName("CreationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("CreatorId")
.HasColumnName("CreatorId")
.HasColumnType("char(36)");
b.Property<int>("DownloadCount")
.HasColumnType("int");
b.Property<int>("FileType")
.HasColumnType("int");
b.Property<DateTime?>("LastModificationTime")
.HasColumnName("LastModificationTime")
.HasColumnType("datetime(6)");
b.Property<Guid?>("LastModifierId")
.HasColumnName("LastModifierId")
.HasColumnType("char(36)");
b.Property<string>("Name")
.IsRequired()
.HasColumnName("Name")
.HasColumnType("varchar(255) CHARACTER SET utf8mb4")
.HasMaxLength(255);
b.Property<string>("SHA256")
.IsRequired()
.HasColumnName("SHA256")
.HasColumnType("varchar(65) CHARACTER SET utf8mb4")
.HasMaxLength(65);
b.Property<long>("Size")
.HasColumnType("bigint");
b.Property<Guid?>("TenantId")
.HasColumnName("TenantId")
.HasColumnType("char(36)");
b.Property<string>("Version")
.IsRequired()
.HasColumnName("Version")
.HasColumnType("varchar(20) CHARACTER SET utf8mb4")
.HasMaxLength(20);
b.HasKey("Id");
b.HasIndex("AppVersionId");
b.HasIndex("Name", "Version");
b.ToTable("AppPlatformVersionFile");
});
modelBuilder.Entity("LINGYUN.Platform.Routes.Route", b =>
{
b.HasOne("LINGYUN.Platform.Routes.Route", null)
.WithMany()
.HasForeignKey("ParentId");
});
modelBuilder.Entity("LINGYUN.Platform.Versions.VersionFile", b =>
{
b.HasOne("LINGYUN.Platform.Versions.AppVersion", "AppVersion")
.WithMany("Files")
.HasForeignKey("AppVersionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
#pragma warning restore 612, 618
}
}
}

108
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs

@ -3,87 +3,55 @@ using IdentityModel;
using LINGYUN.Abp.EventBus.CAP; using LINGYUN.Abp.EventBus.CAP;
using LINGYUN.Abp.ExceptionHandling; using LINGYUN.Abp.ExceptionHandling;
using LINGYUN.Abp.ExceptionHandling.Emailing; using LINGYUN.Abp.ExceptionHandling.Emailing;
using LINGYUN.Abp.IdentityServer; using LINGYUN.Abp.Notifications;
using LINGYUN.Abp.Location.Tencent; using LINGYUN.Platform.EntityFrameworkCore;
using LINGYUN.Abp.MessageService; using LINGYUN.Platform.HttpApi;
using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.TenantManagement;
using LINGYUN.ApiGateway;
using LINGYUN.Platform.MultiTenancy; using LINGYUN.Platform.MultiTenancy;
using LINYUN.Abp.Sms.Aliyun;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models;
using StackExchange.Redis; using StackExchange.Redis;
using System; using System;
using System.Collections.Generic; using System.IO;
using System.Text; using System.Text;
using Volo.Abp; using Volo.Abp;
using Volo.Abp.Account;
using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.Authentication.JwtBearer;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp.BlobStoring;
using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.Caching; using Volo.Abp.Caching;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore.MySQL;
using Volo.Abp.Identity;
using Volo.Abp.Identity.EntityFrameworkCore;
using Volo.Abp.Identity.Localization;
using Volo.Abp.IdentityServer.EntityFrameworkCore;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.PermissionManagement;
using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.PermissionManagement.HttpApi;
using Volo.Abp.PermissionManagement.Identity;
using Volo.Abp.PermissionManagement.IdentityServer;
using Volo.Abp.Security.Claims; using Volo.Abp.Security.Claims;
using Volo.Abp.Security.Encryption; using Volo.Abp.Security.Encryption;
using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.TenantManagement.EntityFrameworkCore; using Volo.Abp.TenantManagement.EntityFrameworkCore;
using Volo.Abp.VirtualFileSystem; using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Platform namespace LINGYUN.Platform
{ {
[DependsOn( [DependsOn(
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(PlatformApplicationModule),
typeof(AbpPermissionManagementDomainIdentityModule), typeof(PlatformHttpApiModule),
typeof(AbpPermissionManagementDomainIdentityServerModule), typeof(PlatformEntityFrameworkCoreModule),
typeof(ApiGatewayApplicationContractsModule), typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpMessageServiceApplicationContractsModule),
typeof(AbpIdentityHttpApiModule),
typeof(AbpIdentityApplicationModule),
typeof(Abp.Account.AbpAccountApplicationModule),
typeof(Abp.Account.AbpAccountHttpApiModule),
typeof(AbpAccountApplicationModule),
typeof(AbpAccountHttpApiModule),
typeof(AbpIdentityServerApplicationModule),
typeof(AbpIdentityServerHttpApiModule),
typeof(AbpSettingManagementApplicationModule),
typeof(AbpSettingManagementHttpApiModule),
typeof(AbpPermissionManagementApplicationModule),
typeof(AbpPermissionManagementHttpApiModule),
typeof(AbpTenantManagementApplicationModule),
typeof(AbpTenantManagementHttpApiModule),
typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(AbpIdentityEntityFrameworkCoreModule),
typeof(AbpIdentityServerEntityFrameworkCoreModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpSettingManagementEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule),
typeof(AbpNotificationModule),
typeof(AbpEmailingExceptionHandlingModule), typeof(AbpEmailingExceptionHandlingModule),
typeof(AbpCAPEventBusModule), typeof(AbpCAPEventBusModule),
typeof(AbpAliyunSmsModule), typeof(AbpBlobStoringFileSystemModule),
#if DEBUG
typeof(AbpTencentLocationModule),
#endif
typeof(AbpAutofacModule) typeof(AbpAutofacModule)
)] )]
public class PlatformHttpApiHostModule : AbpModule public class PlatformHttpApiHostModule : AbpModule
@ -102,11 +70,6 @@ namespace LINGYUN.Platform
}) })
.UseDashboard(); .UseDashboard();
}); });
PreConfigure<IdentityBuilder>(builder =>
{
builder.AddDefaultTokenProviders();
});
} }
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
@ -119,6 +82,23 @@ namespace LINGYUN.Platform
options.UseMySQL(); options.UseMySQL();
}); });
Configure<KestrelServerOptions>(options =>
{
options.Limits.MaxRequestBodySize = null;
options.Limits.MaxRequestBufferSize = null;
});
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.ConfigureAll((containerName, containerConfiguration) =>
{
containerConfiguration.UseFileSystem(fileSystem =>
{
fileSystem.BasePath = Path.Combine(Directory.GetCurrentDirectory(), "file-blob-storing");
});
});
});
// 加解密 // 加解密
Configure<AbpStringEncryptionOptions>(options => Configure<AbpStringEncryptionOptions>(options =>
{ {
@ -127,13 +107,6 @@ namespace LINGYUN.Platform
options.DefaultSalt = Encoding.ASCII.GetBytes("sf&5)s3#"); options.DefaultSalt = Encoding.ASCII.GetBytes("sf&5)s3#");
}); });
Configure<PermissionManagementOptions>(options =>
{
// Rename IdentityServer.Client.ManagePermissions
// See https://github.com/abpframework/abp/blob/dev/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo/Abp/PermissionManagement/IdentityServer/AbpPermissionManagementDomainIdentityServerModule.cs
options.ProviderPolicies[ClientPermissionValueProvider.ProviderName] = AbpIdentityServerPermissions.Clients.ManagePermissions;
});
// 自定义需要处理的异常 // 自定义需要处理的异常
Configure<AbpExceptionHandlingOptions>(options => Configure<AbpExceptionHandlingOptions>(options =>
{ {
@ -147,11 +120,10 @@ namespace LINGYUN.Platform
options.SendStackTrace = true; options.SendStackTrace = true;
// 未指定异常接收者的默认接收邮件 // 未指定异常接收者的默认接收邮件
options.DefaultReceiveEmail = "colin.in@foxmail.com"; options.DefaultReceiveEmail = "colin.in@foxmail.com";
// 指定某种异常发送到哪个邮件 // 指定某种异常发送到哪个邮件
options.HandReceivedException<AbpException>("colin.in@foxmail.com"); options.HandReceivedException<AbpException>("colin.in@foxmail.com");
}); });
Configure<AbpDistributedCacheOptions>(options => Configure<AbpDistributedCacheOptions>(options =>
{ {
// 滑动过期30天 // 滑动过期30天
@ -190,10 +162,6 @@ namespace LINGYUN.Platform
{ {
options.Languages.Add(new LanguageInfo("en", "en", "English")); options.Languages.Add(new LanguageInfo("en", "en", "English"));
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文"));
options.Resources
.Get<IdentityResource>()
.AddVirtualJson("/LINGYUN/Platform/Identity/Localization");
}); });
context.Services.AddAuthentication("Bearer") context.Services.AddAuthentication("Bearer")
@ -224,6 +192,14 @@ namespace LINGYUN.Platform
} }
} }
//public override void OnPostApplicationInitialization(ApplicationInitializationContext context)
//{
// var backgroundJobManager = context.ServiceProvider.GetRequiredService<IBackgroundJobManager>();
// // 五分钟执行一次的定时任务
// AsyncHelper.RunSync(async () => await
// backgroundJobManager.EnqueueAsync(CronGenerator.Minute(5), new NotificationCleanupExpritionJobArgs(200)));
//}
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)
{ {
var app = context.GetApplicationBuilder(); var app = context.GetApplicationBuilder();
@ -239,6 +215,8 @@ namespace LINGYUN.Platform
app.UseAuthentication(); app.UseAuthentication();
// jwt // jwt
app.UseJwtTokenMiddleware(); app.UseJwtTokenMiddleware();
// 授权
app.UseAuthorization();
// 多租户 // 多租户
app.UseMultiTenancy(); app.UseMultiTenancy();
// Swagger // Swagger

2
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Program.cs

@ -1,4 +1,4 @@
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Serilog; using Serilog;

4
aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Properties/launchSettings.json

@ -3,7 +3,7 @@
"windowsAuthentication": false, "windowsAuthentication": false,
"anonymousAuthentication": true, "anonymousAuthentication": true,
"iisExpress": { "iisExpress": {
"applicationUrl": "http://localhost:54521", "applicationUrl": "http://localhost:64238",
"sslPort": 0 "sslPort": 0
} }
}, },
@ -11,7 +11,7 @@
"LINGYUN.Platform.HttpApi.Host": { "LINGYUN.Platform.HttpApi.Host": {
"commandName": "Project", "commandName": "Project",
"launchBrowser": false, "launchBrowser": false,
"applicationUrl": "http://localhost:30010", "applicationUrl": "http://localhost:30025",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
} }

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

Loading…
Cancel
Save