|
@@ -324,58 +324,7 @@ namespace TEAMModelOS.Controllers.Core
|
|
|
return Ok(new { bloblogs = bloblogs });
|
|
|
}
|
|
|
}
|
|
|
- /// <summary>
|
|
|
- /// 测试单个文本内容的上传
|
|
|
- /// {"containerName":"hbcn","uploadSize":5000,"optUrls":[{"url":"video/37Z888piCvm9.mp4","size":0},{}]}
|
|
|
- /// </summary>
|
|
|
- /// <param name="azureBlobSASDto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPost("update-blobsize")]
|
|
|
- public async Task<ActionResult> updateBlobsSize(JsonElement request)
|
|
|
- {
|
|
|
- request.TryGetProperty("containerName", out JsonElement containerName);
|
|
|
- request.TryGetProperty("optUrls", out JsonElement optUrls);
|
|
|
- var name = containerName.GetString();
|
|
|
- var urls = optUrls.ToObject<List<OptUrl>>();
|
|
|
- var client = _azureStorage.GetBlobContainerClient(name);
|
|
|
- var disSize = urls.Select(x => x.size).Sum();
|
|
|
- RedisValue value = default;
|
|
|
- long blobSize = 0;
|
|
|
- value = _azureRedis.GetRedisClient(8).HashGet($"Blob:Record", name);
|
|
|
- if (value != default && !value.IsNullOrEmpty)
|
|
|
- {
|
|
|
- JsonElement record = value.ToString().ToObject<JsonElement>();
|
|
|
- if (record.TryGetInt64(out blobSize))
|
|
|
- {
|
|
|
- }
|
|
|
- }
|
|
|
- long? useSize = blobSize + disSize;
|
|
|
- await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", name, useSize);
|
|
|
- Dictionary<string, double?> catalog = new Dictionary<string, double?>();
|
|
|
- HashSet<string> root = new HashSet<string>();
|
|
|
- foreach (var x in urls)
|
|
|
- {
|
|
|
- string[] uls = System.Web.HttpUtility.UrlDecode(x.url, Encoding.UTF8).Split("/");
|
|
|
- if (uls != null)
|
|
|
- {
|
|
|
- string u = !string.IsNullOrEmpty(uls[0]) ? uls[0] : uls[1];
|
|
|
- root.Add(u);
|
|
|
-
|
|
|
- await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Blob:Catalog:{name}", u, x.size);
|
|
|
- catalog[u] = await _azureRedis.GetRedisClient(8).SortedSetScoreAsync($"Blob:Catalog:{name}", u);
|
|
|
- if (catalog[u] < 0)
|
|
|
- {
|
|
|
- await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{name}", u);
|
|
|
- catalog[u] = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- var messageBlob = new ServiceBusMessage(new { id = Guid.NewGuid().ToString(), progress = "update", root = root.ToArray(), name = name }.ToJsonString()); ;
|
|
|
- messageBlob.ApplicationProperties.Add("name", "Blob");
|
|
|
- var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
|
|
|
- await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageBlob);
|
|
|
- return Ok(new { size = useSize, catalog });
|
|
|
- }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 重命名
|
|
|
/// {"scope":"school","cntr":"hbcn","id":"bbf24ca7-487e-4196-8c99-b2c418a2d1b1","newName":"video/核能1.mp4"}
|
|
@@ -660,7 +609,7 @@ namespace TEAMModelOS.Controllers.Core
|
|
|
/// <summary>
|
|
|
/// 删除多个Url,只会在内容模块使用该接口
|
|
|
///
|
|
|
- /// {"cntr":"","urls":["res/test/1.json","res/test/2.json"]}
|
|
|
+ ///
|
|
|
/// {"scope":"school","cntr":"hbcn","blobs":[{"path":"other/test/1.json","id":"c107069d-4553-46c2-8c81-b3e6b4599393"},{"path":"res/test","id":"09d59b87-68c0-45fa-8221-9931a4190a2f"}]}
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|