|
@@ -48,18 +48,24 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(survey, id.ToString(), new PartitionKey($"{code}"));
|
|
|
} else if (name.ToString().Equals("Vote")) {
|
|
|
- Vote vote = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(id.ToString(), new PartitionKey($"{code}"));
|
|
|
- if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(vote.startTime) > 0 && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(vote.endTime) < 0)
|
|
|
+ Vote vote;
|
|
|
+ var sresponse = await client.GetContainer("TEAMModelOS", "Common").ReadItemStreamAsync(id.ToString(), new PartitionKey($"{code}"));
|
|
|
+ if (sresponse.Status == 200)
|
|
|
{
|
|
|
- vote.progress = "going";
|
|
|
+ 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}"));
|
|
|
}
|
|
|
- else if (DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().CompareTo(vote.endTime) > 0)
|
|
|
- {
|
|
|
- vote.progress = "finish";
|
|
|
- }
|
|
|
-
|
|
|
- await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(vote, id.ToString(), new PartitionKey($"{code}"));
|
|
|
}
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|