From 5eaedc3003aa99f30e15d99798131e342c85a16f Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Fri, 4 Mar 2022 18:33:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(tencent-blob):=20=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E7=BC=BA=E5=A4=B1=E7=9A=84=E6=9C=AC=E5=9C=B0=E5=8C=96=E6=96=87?= =?UTF-8?q?=E6=9C=AC.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LINGYUN.Abp.BlobStoring.Tencent.csproj | 8 ++++++++ .../Tencent/AbpBlobStoringTencentCloudModule.cs | 17 +++++++++++++++++ .../BlobStoring/Tencent/Localization/en.json | 6 ++++++ .../Tencent/Localization/zh-Hans.json | 6 ++++++ .../Tencent/TencentCloudBlobProvider.cs | 3 ++- 5 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/en.json create mode 100644 aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/zh-Hans.json diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN.Abp.BlobStoring.Tencent.csproj b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN.Abp.BlobStoring.Tencent.csproj index 9697fa205..75891736b 100644 --- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN.Abp.BlobStoring.Tencent.csproj +++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN.Abp.BlobStoring.Tencent.csproj @@ -9,6 +9,14 @@ 腾讯云Oss对象存储Abp集成 + + + + + + + + diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/AbpBlobStoringTencentCloudModule.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/AbpBlobStoringTencentCloudModule.cs index db9a6c0dd..aa00b6f84 100644 --- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/AbpBlobStoringTencentCloudModule.cs +++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/AbpBlobStoringTencentCloudModule.cs @@ -1,6 +1,9 @@ using LINGYUN.Abp.Tencent; +using LINGYUN.Abp.Tencent.Localization; using Volo.Abp.BlobStoring; +using Volo.Abp.Localization; using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.BlobStoring.Tencent; @@ -9,4 +12,18 @@ namespace LINGYUN.Abp.BlobStoring.Tencent; typeof(AbpTencentCloudModule))] public class AbpBlobStoringTencentCloudModule : AbpModule { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/LINGYUN/Abp/BlobStoring/Tencent/Localization"); + }); + } } \ No newline at end of file diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/en.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/en.json new file mode 100644 index 000000000..ff498bc5e --- /dev/null +++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/en.json @@ -0,0 +1,6 @@ +{ + "culture": "en", + "texts": { + "TencentCloud:10101": "The Size of the uploaded file cannot exceed Tencent cloud storage limit {Size}!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/zh-Hans.json b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/zh-Hans.json new file mode 100644 index 000000000..67895f04d --- /dev/null +++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/Localization/zh-Hans.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hans", + "texts": { + "TencentCloud:10101": "上传的文件大小不能超出腾讯云存储限制 {Size}!" + } +} \ No newline at end of file diff --git a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/TencentCloudBlobProvider.cs b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/TencentCloudBlobProvider.cs index 43f136b14..3d09141f7 100644 --- a/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/TencentCloudBlobProvider.cs +++ b/aspnet-core/modules/cloud-tencent/LINGYUN.Abp.BlobStoring.Tencent/LINGYUN/Abp/BlobStoring/Tencent/TencentCloudBlobProvider.cs @@ -81,7 +81,8 @@ public class TencentCloudBlobProvider : BlobProviderBase, ITransientDependency && (maxStreamSize <= 0 || maxStreamSize < args.BlobStream.Length / 1024 / 1024))) { - throw new BusinessException("TencentCloud:10101"); + throw new BusinessException("TencentCloud:10101") + .WithData("Size", maxStreamSizeString); } var ossClient = await GetOssClientAsync(args);