|
@@ -20,6 +20,7 @@ using StackExchange.Redis;
|
|
|
using Azure.Messaging.ServiceBus;
|
|
|
using static TEAMModelOS.SDK.DI.AzureStorageBlobExtensions;
|
|
|
using System.Linq;
|
|
|
+using TEAMModelOS.SDK.Helper.Common.CollectionHelper;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers.Core
|
|
|
{
|
|
@@ -279,7 +280,7 @@ namespace TEAMModelOS.Controllers.Core
|
|
|
|
|
|
/// <summary>
|
|
|
/// 测试单个文本内容的上传
|
|
|
- /// {"containerName":"hbcn","urls":["video/xxx.mp4","res/xxx.png"]}
|
|
|
+ /// {"containerName":"hbcn","urls":["video/xxx.mp4","res/xxx.png"],"prefix":"exam/0546cc1b-b8f4-4c96-ba51-0191ee78ad37/paper/b2cad57a-36b5-327f-5dd1-74e6f4397c86"}
|
|
|
/// </summary>
|
|
|
/// <param name="azureBlobSASDto"></param>
|
|
|
/// <returns></returns>
|
|
@@ -288,11 +289,24 @@ namespace TEAMModelOS.Controllers.Core
|
|
|
{
|
|
|
request.TryGetProperty("containerName", out JsonElement containerName);
|
|
|
request.TryGetProperty("urls", out JsonElement optUrls);
|
|
|
+ request.TryGetProperty("prefix", out JsonElement prefixjs);
|
|
|
var name = containerName.GetString();
|
|
|
- var urls = optUrls.ToObject<List<string>>();
|
|
|
+ var urls = optUrls.ValueKind.Equals(JsonValueKind.Array) ? optUrls.ToObject<List<string>>() : null ;
|
|
|
+ string prefix = null;
|
|
|
+ if (prefixjs.ValueKind.Equals(JsonValueKind.String)) {
|
|
|
+ prefix =prefixjs.GetString();
|
|
|
+ }
|
|
|
+
|
|
|
var client = _azureStorage.GetBlobContainerClient(name);
|
|
|
- var urlsSize = await client.GetBlobsSize(urls);
|
|
|
- return Ok(new { urlsSize });
|
|
|
+ List<OptUrl> urlsSize = null;
|
|
|
+ if (urls.IsNotEmpty()) {
|
|
|
+ urlsSize = await client.GetBlobsSize(urls);
|
|
|
+ }
|
|
|
+ long? prefixSize = 0;
|
|
|
+ if (prefix != null) {
|
|
|
+ prefixSize = await client.GetBlobsSize(System.Web.HttpUtility.UrlDecode(prefix, Encoding.UTF8) );
|
|
|
+ }
|
|
|
+ return Ok(new { urlsSize, prefixSize });
|
|
|
}
|
|
|
|
|
|
/*
|