|
@@ -99,12 +99,20 @@ namespace TEAMModelOS.Controllers
|
|
[HttpPost("test-ru")]
|
|
[HttpPost("test-ru")]
|
|
public async Task<IActionResult> FixSemester(JsonElement json)
|
|
public async Task<IActionResult> FixSemester(JsonElement json)
|
|
{
|
|
{
|
|
|
|
+ //var cm = _azureRedis.GetConnectionMultiplexer();
|
|
|
|
+ //var keys = cm.GetServer(cm.GetEndPoints()[0]).Keys(cm.GetDatabase(8).Database,"Blob:Catalog*");
|
|
|
|
+ //List<string> ks = new List<string>();
|
|
|
|
+ //foreach (var key in keys)
|
|
|
|
+ //{
|
|
|
|
+ // ks.Add(key.ToString());
|
|
|
|
+ //}
|
|
|
|
+
|
|
var result4 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam'and c.owner='teacher'", null, pageSize: 200);
|
|
var result4 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam'and c.owner='teacher'", null, pageSize: 200);
|
|
var result0 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam'and c.owner='teacher' and STARTSWITH(c.code,'Exam-')", null, pageSize: 200);
|
|
var result0 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam'and c.owner='teacher' and STARTSWITH(c.code,'Exam-')", null, pageSize: 200);
|
|
var result1 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam' and c.owner='teacher' and contains(c.code,'Exam-')", null, pageSize: 200);
|
|
var result1 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam' and c.owner='teacher' and contains(c.code,'Exam-')", null, pageSize: 200);
|
|
- var result2 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam' and c.owner='school' and contains(c.code,'Exam-hbc')",null, pageSize:200);
|
|
|
|
- var result3 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam' and c.owner='school' ", "Exam-hbcn",pageSize:200);
|
|
|
|
- return Ok(new {ru4=result4.ru ,count4= result4.list.Count, ru0 = result0.ru,count0= result0.list.Count(),ru1 = result1.ru,count1=result1.list.Count(), ru2 = result2.ru, count2 = result2.list.Count() ,ru3=result3.ru,count3= result3.list.Count()});
|
|
|
|
|
|
+ var result2 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam' and c.owner='school' and contains(c.code,'Exam-hbc')", null, pageSize: 200);
|
|
|
|
+ var result3 = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Common).GetList<ExamInfo>($"select value c from c where c.pk='Exam' and c.owner='school' ", "Exam-hbcn", pageSize: 200);
|
|
|
|
+ return Ok(new { ru4 = result4.ru, count4 = result4.list.Count, ru0 = result0.ru, count0 = result0.list.Count(), ru1 = result1.ru, count1 = result1.list.Count(), ru2 = result2.ru, count2 = result2.list.Count(), ru3 = result3.ru, count3 = result3.list.Count() });
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <summary>
|
|
/// 测试五育画像数据推送
|
|
/// 测试五育画像数据推送
|
|
@@ -1246,44 +1254,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- /// <summary>
|
|
|
|
- /// 测试blob多线程写入同一个文件
|
|
|
|
- /// </summary>
|
|
|
|
- /// <returns></returns>
|
|
|
|
- [ProducesDefaultResponseType]
|
|
|
|
- [HttpPost("blobroot")]
|
|
|
|
- public async Task<IActionResult> MultipleBlob(JsonElement jsonMsg)
|
|
|
|
- {
|
|
|
|
- if (jsonMsg.TryGetProperty("name", out JsonElement name) && name.ValueKind == JsonValueKind.String
|
|
|
|
- && jsonMsg.TryGetProperty("root", out JsonElement root) && root.ValueKind == JsonValueKind.String)
|
|
|
|
- {
|
|
|
|
- List<Dictionary<string, double?>> list = new List<Dictionary<string, double?>>();
|
|
|
|
- string u = System.Web.HttpUtility.UrlDecode($"{root}", Encoding.UTF8).Split("/")[0];
|
|
|
|
- var client = _azureStorage.GetBlobContainerClient($"{name}");
|
|
|
|
- var size = await client.GetBlobsSize(u);
|
|
|
|
- await _azureRedis.GetRedisClient(8).SortedSetRemoveAsync($"Blob:Catalog:{name}", u);
|
|
|
|
- await _azureRedis.GetRedisClient(8).SortedSetIncrementAsync($"Blob:Catalog:{name}", u, size.HasValue ? size.Value : 0);
|
|
|
|
- var scores = await _azureRedis.GetRedisClient(8).SortedSetRangeByRankWithScoresAsync($"Blob:Catalog:{name}");
|
|
|
|
- double blobsize = 0;
|
|
|
|
- if (scores != default && scores != null)
|
|
|
|
- {
|
|
|
|
- foreach (var score in scores)
|
|
|
|
- {
|
|
|
|
- blobsize = blobsize + score.Score;
|
|
|
|
- list.Add(new Dictionary<string, double?>() { { score.Element.ToString(), score.Score } });
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- await _azureRedis.GetRedisClient(8).HashSetAsync($"Blob:Record", new RedisValue($"{name}"), new RedisValue($"{blobsize}"));
|
|
|
|
-
|
|
|
|
- await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-ServiceBus,Blob() 容器:{name}使用:{root},文件分类:{list.ToJsonString()}", GroupNames.成都开发測試群組);
|
|
|
|
- return Ok(list);
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- return Ok();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
|
|
private async Task<int> SendNotification()
|
|
private async Task<int> SendNotification()
|
|
{
|
|
{
|
|
@@ -1419,58 +1390,7 @@ namespace TEAMModelOS.Controllers
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
|
- /// 删除
|
|
|
|
- /// </summary>
|
|
|
|
- /// <param name="request"></param>
|
|
|
|
- /// <returns></returns>
|
|
|
|
- [ProducesDefaultResponseType]
|
|
|
|
- //[AuthToken(Roles = "teacher")]
|
|
|
|
- [HttpPost("fix-blob-content")]
|
|
|
|
- public async Task<IActionResult> FixBlobContent(JsonElement request)
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- if (!request.TryGetProperty("name", out JsonElement name)) return BadRequest();
|
|
|
|
- if (!request.TryGetProperty("scope", out JsonElement _scope)) return BadRequest();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- var client = _azureCosmos.GetCosmosClient();
|
|
|
|
- List<string> prefixs = new List<string>() { "audio", "doc", "image", "other", "res", "video", "thum" };
|
|
|
|
- var ContainerClient = _azureStorage.GetBlobContainerClient($"{name}");
|
|
|
|
- string scope = "private";
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- scope = $"{_scope}";
|
|
|
|
-
|
|
|
|
- var tb = "Teacher";
|
|
|
|
- if (scope != "private")
|
|
|
|
- {
|
|
|
|
- tb = "School";
|
|
|
|
- }
|
|
|
|
- long now = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
|
|
-
|
|
|
|
- foreach (var prefix in prefixs)
|
|
|
|
- {
|
|
|
|
- List<string> items = await ContainerClient.List(prefix);
|
|
|
|
- foreach (var item in items)
|
|
|
|
- {
|
|
|
|
- var urlsSize = await ContainerClient.GetBlobsSize(item);
|
|
|
|
- Bloblog bloblog = new Bloblog { id = Guid.NewGuid().ToString(), code = $"Bloblog-{name}", pk = "Bloblog", time = now, size = urlsSize != null && urlsSize.HasValue ? urlsSize.Value : 0, type = prefix };
|
|
|
|
- await client.GetContainer(Constant.TEAMModelOS, tb).UpsertItemAsync(bloblog, new Azure.Cosmos.PartitionKey(bloblog.code));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- return new OkObjectResult(new { });
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- catch (Exception ex)
|
|
|
|
- {
|
|
|
|
- await _dingDing.SendBotMsg($"TEAMModelFunction,ActivityHttpTrigger,fix-blob-content()\n{ex.Message}\n{ex.StackTrace}", GroupNames.醍摩豆服務運維群組);
|
|
|
|
- return new BadRequestResult();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
/// <summary>
|
|
/// <summary>
|
|
///
|
|
///
|
|
/// </summary>
|
|
/// </summary>
|