diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetPublicFileInput.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetPublicFileInput.cs index df15796ed..296692499 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetPublicFileInput.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetPublicFileInput.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.ComponentModel.DataAnnotations; namespace LINGYUN.Abp.OssManagement { @@ -10,5 +11,9 @@ namespace LINGYUN.Abp.OssManagement public string Path { get; set; } public string Process { get; set; } + /// + /// 解决通过路由传递租户标识时,abp写入cookies + /// + public Guid? TenantId { get; set; } } } diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetStaticFileInput.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetStaticFileInput.cs index 833c1db11..0ab69a4c7 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetStaticFileInput.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Application.Contracts/LINGYUN/Abp/OssManagement/GetStaticFileInput.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System; +using System.ComponentModel.DataAnnotations; namespace LINGYUN.Abp.OssManagement { @@ -12,5 +13,9 @@ namespace LINGYUN.Abp.OssManagement public string Bucket { get; set; } public string Process { get; set; } + /// + /// 解决通过路由传递租户标识时,abp写入cookies + /// + public Guid? TenantId { get; set; } } } diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PrivateFilesController.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PrivateFilesController.cs index 3d5cfd67e..359f3dddc 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PrivateFilesController.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PrivateFilesController.cs @@ -51,9 +51,16 @@ namespace LINGYUN.Abp.OssManagement [Route("{Name}/{Process}")] [Route("p/{Path}/{Name}")] [Route("p/{Path}/{Name}/{Process}")] + [Route("t/{TenantId}/{Name}")] + [Route("t/{TenantId}/{Name}/{Process}")] + [Route("t/{TenantId}/p/{Path}/{Name}")] + [Route("t/{TenantId}/p/{Path}/{Name}/{Process}")] public async virtual Task GetAsync([FromRoute] GetPublicFileInput input) { - return await _service.GetAsync(input); + using (CurrentTenant.Change(input.TenantId ?? CurrentTenant.Id)) + { + return await _service.GetAsync(input); + } } [HttpDelete] diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PublicFilesController.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PublicFilesController.cs index ab7b769e4..c016dc6e1 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PublicFilesController.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/PublicFilesController.cs @@ -50,9 +50,16 @@ namespace LINGYUN.Abp.OssManagement [Route("{Name}/{Process}")] [Route("p/{Path}/{Name}")] [Route("p/{Path}/{Name}/{Process}")] + [Route("t/{TenantId}/{Name}")] + [Route("t/{TenantId}/{Name}/{Process}")] + [Route("t/{TenantId}/p/{Path}/{Name}")] + [Route("t/{TenantId}/p/{Path}/{Name}/{Process}")] public async virtual Task GetAsync([FromRoute] GetPublicFileInput input) { - return await _publicFileAppService.GetAsync(input); + using (CurrentTenant.Change(input.TenantId ?? CurrentTenant.Id)) + { + return await _publicFileAppService.GetAsync(input); + } } [HttpDelete] diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/StaticFilesController.cs b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/StaticFilesController.cs index 348cbc13f..ae5ea598d 100644 --- a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/StaticFilesController.cs +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi/LINGYUN/Abp/OssManagement/StaticFilesController.cs @@ -39,9 +39,16 @@ namespace LINGYUN.Abp.OssManagement [Route("{Bucket}/{Name}/{Process}")] [Route("{Bucket}/p/{Path}/{Name}")] [Route("{Bucket}/p/{Path}/{Name}/{Process}")] + [Route("t/{TenantId}/{Bucket}/{Name}")] + [Route("t/{TenantId}/{Bucket}/{Name}/{Process}")] + [Route("t/{TenantId}/{Bucket}/p/{Path}/{Name}")] + [Route("t/{TenantId}/{Bucket}/p/{Path}/{Name}/{Process}")] public async virtual Task GetAsync([FromRoute] GetStaticFileInput input) { - return await _staticFilesAppServic.GetAsync(input); + using (CurrentTenant.Change(input.TenantId ?? CurrentTenant.Id)) + { + return await _staticFilesAppServic.GetAsync(input); + } } } }