103 changed files with 4735 additions and 147 deletions
@ -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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -0,0 +1,10 @@ |
|||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Platform |
||||
|
{ |
||||
|
[DependsOn(typeof(PlatformDomainSharedModule))] |
||||
|
public class PlatformApplicationContractModule : AbpModule |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -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>(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
namespace LINGYUN.Platform.Versions |
||||
|
{ |
||||
|
public class VersionDeleteDto |
||||
|
{ |
||||
|
public string Version { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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>(); |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Versions |
||||
|
{ |
||||
|
public class VersionFileDeleteDto |
||||
|
{ |
||||
|
public Guid VersionId { get; set; } |
||||
|
public string FileName { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using System; |
||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Versions |
||||
|
{ |
||||
|
public class VersionGetByIdDto : EntityDto<Guid> |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Abp.Application.Dtos; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Versions |
||||
|
{ |
||||
|
public class VersionGetByPagedDto : PagedAndSortedResultRequestDto |
||||
|
{ |
||||
|
public string Filter { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -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>(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
using Volo.Abp.Application.Services; |
||||
|
|
||||
|
namespace LINGYUN.Platform |
||||
|
{ |
||||
|
public abstract class PlatformApplicationServiceBase : ApplicationService |
||||
|
{ |
||||
|
protected PlatformApplicationServiceBase() |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -0,0 +1,10 @@ |
|||||
|
using Volo.Abp.Localization; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Localization |
||||
|
{ |
||||
|
[LocalizationResourceName("AppPlatform")] |
||||
|
public class PlatformResource |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -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" |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
{ |
||||
|
"culture": "zh-Hans", |
||||
|
"texts": { |
||||
|
"UploadFileSizeBeyondLimit": "上传文件大小不能超过 {0} MB!", |
||||
|
"NotAllowedFileExtensionName": "不被允许的文件扩展名: {0}!", |
||||
|
"DisplayName:VersionFileLimitLength": "文件限制大小", |
||||
|
"Description:VersionFileLimitLength": "上传文件的限制大小,单位(MB)", |
||||
|
"DisplayName:AllowVersionFileExtensions": "文件扩展名", |
||||
|
"Description:AllowVersionFileExtensions": "允许的上传文件扩展名列表,多个扩展名以,分隔,无需输入.符号" |
||||
|
} |
||||
|
} |
||||
@ -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 |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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 |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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)); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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 |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
namespace LINGYUN.Platform.Routes |
||||
|
{ |
||||
|
public class RoleRouteConsts |
||||
|
{ |
||||
|
public static int MaxRoleNameLength |
||||
|
{ |
||||
|
get; |
||||
|
set; |
||||
|
} = 256; |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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 |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
@ -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 |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -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"; |
||||
|
} |
||||
|
} |
||||
@ -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)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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) |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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 |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -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)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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("."); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
using Volo.Abp.BlobStoring; |
||||
|
|
||||
|
namespace LINGYUN.Platform.Versions |
||||
|
{ |
||||
|
[BlobContainerName("app-platform-version")] |
||||
|
public class VersionContainer |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
@ -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}"; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -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; } |
||||
|
} |
||||
|
} |
||||
@ -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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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 }); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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) |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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; |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,4 @@ |
|||||
|
bin |
||||
|
obj |
||||
|
Logs |
||||
|
appsettings.*.json |
||||
@ -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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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();
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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,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> |
||||
@ -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 |
||||
{ |
{ |
||||
@ -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 |
||||
{ |
{ |
||||
@ -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 |
||||
{ |
{ |
||||
@ -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 |
||||
{ |
{ |
||||
@ -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) |
||||
@ -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; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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(); |
||||
|
} |
||||
|
} |
||||
@ -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" |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,4 +1,2 @@ |
|||||
bin |
.vs |
||||
obj |
file-blob-storing |
||||
Logs |
|
||||
appsettings.*.json |
|
||||
@ -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
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -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
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue