|
@@ -30,8 +30,7 @@ namespace TEAMModelFunction
|
|
_azureRedis = azureRedis;
|
|
_azureRedis = azureRedis;
|
|
}
|
|
}
|
|
[FunctionName("Exam")]
|
|
[FunctionName("Exam")]
|
|
- public async Task Exam([ServiceBusTrigger("active-task", "exam", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
|
|
|
|
- // public async Task Exam([ServiceBusTrigger("active-task", "exam", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
|
|
|
|
|
|
+ public async Task Exam([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "exam", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -44,23 +43,6 @@ namespace TEAMModelFunction
|
|
ExamInfo exam = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"{code}"));
|
|
ExamInfo exam = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"{code}"));
|
|
exam.progress = progress.ToString();
|
|
exam.progress = progress.ToString();
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"{code}"));
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"{code}"));
|
|
- /* keyValuePairs.TryGetValue("id", out object id);
|
|
|
|
- keyValuePairs.TryGetValue("name", out object name);
|
|
|
|
- keyValuePairs.TryGetValue("code", out object code);*/
|
|
|
|
- //keyValuePairs.TryGetValue("status", out object progress);
|
|
|
|
- /*if (name.ToString().Equals("Exam", StringComparison.OrdinalIgnoreCase))
|
|
|
|
- {
|
|
|
|
- ExamInfo exam = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(id.ToString(), new PartitionKey($"{code}"));
|
|
|
|
- if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(exam.startTime) > 0 && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(exam.endTime) < 0)
|
|
|
|
- {
|
|
|
|
- exam.progress = "going";
|
|
|
|
- }
|
|
|
|
- else if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(exam.endTime) > 0)
|
|
|
|
- {
|
|
|
|
- exam.progress = "finish";
|
|
|
|
- }
|
|
|
|
- await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(exam, id.ToString(), new PartitionKey($"{code}"));
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -69,7 +51,7 @@ namespace TEAMModelFunction
|
|
|
|
|
|
}
|
|
}
|
|
[FunctionName("Vote")]
|
|
[FunctionName("Vote")]
|
|
- public async Task Vote([ServiceBusTrigger("active-task", "vote", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
|
|
|
|
|
|
+ public async Task Vote([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "vote", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -82,29 +64,6 @@ namespace TEAMModelFunction
|
|
Vote vote = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(id.ToString(), new PartitionKey($"{code}"));
|
|
Vote vote = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(id.ToString(), new PartitionKey($"{code}"));
|
|
vote.progress = progress.ToString();
|
|
vote.progress = progress.ToString();
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(vote, id.ToString(), new PartitionKey($"{code}"));
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(vote, id.ToString(), new PartitionKey($"{code}"));
|
|
- /*keyValuePairs.TryGetValue("id", out object id);
|
|
|
|
- keyValuePairs.TryGetValue("name", out object name);
|
|
|
|
- keyValuePairs.TryGetValue("code", out object code);*/
|
|
|
|
- //keyValuePairs.TryGetValue("status", out object progress);
|
|
|
|
- /*if (name.ToString().Equals("Vote", StringComparison.OrdinalIgnoreCase))
|
|
|
|
- {
|
|
|
|
- Vote vote;
|
|
|
|
- var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(id.ToString(), new PartitionKey($"{code}"));
|
|
|
|
- if (sresponse.Status == 200)
|
|
|
|
- {
|
|
|
|
- using var json = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
|
- vote = json.ToObject<Vote>();
|
|
|
|
- if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(vote.startTime) > 0 && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(vote.endTime) < 0)
|
|
|
|
- {
|
|
|
|
- vote.progress = "going";
|
|
|
|
- }
|
|
|
|
- else if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(vote.endTime) > 0)
|
|
|
|
- {
|
|
|
|
- vote.progress = "finish";
|
|
|
|
- }
|
|
|
|
- await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(vote, id.ToString(), new PartitionKey($"{code}"));
|
|
|
|
- }
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -113,7 +72,7 @@ namespace TEAMModelFunction
|
|
|
|
|
|
}
|
|
}
|
|
[FunctionName("Survey")]
|
|
[FunctionName("Survey")]
|
|
- public async Task Survey([ServiceBusTrigger("active-task", "survey", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
|
|
|
|
|
|
+ public async Task Survey([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "survey", Connection = "Azure:ServiceBus:ConnectionString")] string msg)
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -126,23 +85,6 @@ namespace TEAMModelFunction
|
|
Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(id.ToString(), new PartitionKey($"{code}"));
|
|
Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(id.ToString(), new PartitionKey($"{code}"));
|
|
survey.progress = progress.ToString();
|
|
survey.progress = progress.ToString();
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(survey, id.ToString(), new PartitionKey($"{code}"));
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(survey, id.ToString(), new PartitionKey($"{code}"));
|
|
- /*keyValuePairs.TryGetValue("id", out object id);
|
|
|
|
- keyValuePairs.TryGetValue("name", out object name);
|
|
|
|
- keyValuePairs.TryGetValue("code", out object code);*/
|
|
|
|
- //keyValuePairs.TryGetValue("status", out object progress);
|
|
|
|
- /*if (name.ToString().Equals("Survey", StringComparison.OrdinalIgnoreCase))
|
|
|
|
- {
|
|
|
|
- Survey survey = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(id.ToString(), new PartitionKey($"{code}"));
|
|
|
|
- if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(survey.startTime) > 0 && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(survey.endTime) < 0)
|
|
|
|
- {
|
|
|
|
- survey.progress = "going";
|
|
|
|
- }
|
|
|
|
- else if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(survey.endTime) > 0)
|
|
|
|
- {
|
|
|
|
- survey.progress = "finish";
|
|
|
|
- }
|
|
|
|
- await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(survey, id.ToString(), new PartitionKey($"{code}"));
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -150,7 +92,7 @@ namespace TEAMModelFunction
|
|
}
|
|
}
|
|
}
|
|
}
|
|
[FunctionName("Blob")]
|
|
[FunctionName("Blob")]
|
|
- public async Task Blob([ServiceBusTrigger("active-task", "blob", Connection = "Azure:ServiceBus:ConnectionString")] string msg) {
|
|
|
|
|
|
+ public async Task Blob([ServiceBusTrigger("%Azure:ServiceBus:ActiveTask%", "blob", Connection = "Azure:ServiceBus:ConnectionString")] string msg) {
|
|
try
|
|
try
|
|
{
|
|
{
|
|
// await _dingDing.SendBotMsg($"ServiceBus,Blob(){msg}", GroupNames.醍摩豆服務運維群組);
|
|
// await _dingDing.SendBotMsg($"ServiceBus,Blob(){msg}", GroupNames.醍摩豆服務運維群組);
|