CrazyIter_Bin 4 年之前
父節點
當前提交
9829ff5ce6
共有 1 個文件被更改,包括 5 次插入5 次删除
  1. 5 5
      TEAMModelOS/Controllers/Common/SurveyController.cs

+ 5 - 5
TEAMModelOS/Controllers/Common/SurveyController.cs

@@ -112,7 +112,7 @@ namespace TEAMModelOS.Controllers
                 var stimestamp = DateTimeOffset.UtcNow.AddDays(-30).ToUnixTimeMilliseconds();
                 if (requert.TryGetProperty("stime", out JsonElement stime))
                 {
-                    if (!stime.ValueKind.Equals(JsonValueKind.Undefined) && stime.TryGetInt64(out long data))
+                    if (!stime.ValueKind.Equals(JsonValueKind.Undefined)&& !stime.ValueKind.Equals(JsonValueKind.Null)  && stime.TryGetInt64(out long data))
                     {
                         stimestamp = data;
                     };
@@ -121,14 +121,14 @@ namespace TEAMModelOS.Controllers
                 var etimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 if (requert.TryGetProperty("etime", out JsonElement etime))
                 {
-                    if (!etime.ValueKind.Equals(JsonValueKind.Undefined) && etime.TryGetInt64(out long data))
+                    if (!etime.ValueKind.Equals(JsonValueKind.Null)&&!etime.ValueKind.Equals(JsonValueKind.Undefined) && etime.TryGetInt64(out long data))
                     {
                         etimestamp = data;
                     };
 
                 };
                 var progresssql = "";
-                if (!requert.TryGetProperty("progress", out JsonElement progress))
+                if (requert.TryGetProperty("progress", out JsonElement progress))
                 {
 
                     if (!progress.ValueKind.Equals(JsonValueKind.Undefined) && !progress.ValueKind.Equals(JsonValueKind.Null) && progress.ValueKind.Equals(JsonValueKind.String))
@@ -141,7 +141,7 @@ namespace TEAMModelOS.Controllers
                 int? topcout = null;
                 if (requert.TryGetProperty("count", out JsonElement jcount))
                 {
-                    if (!jcount.ValueKind.Equals(JsonValueKind.Undefined) && jcount.TryGetInt32(out int data))
+                    if (!jcount.ValueKind.Equals(JsonValueKind.Undefined) && !jcount.ValueKind.Equals(JsonValueKind.Null) && jcount.TryGetInt32(out int data))
                     {
                         topcout = data;
                     }
@@ -160,7 +160,7 @@ namespace TEAMModelOS.Controllers
                 };
                 List<object> surveys = new List<object>();
                 var client = _azureCosmos.GetCosmosClient();
-                var query = $"select   c.id,c.name,c.code,c.startTime,c.endTime,c.progress from c where c.createTime >= {stimestamp} and c.createTime <= {etimestamp}  {progresssql } ";
+                var query = $"select c.id,c.name,c.code,c.startTime,c.endTime,c.progress from c where c.createTime >= {stimestamp} and c.createTime <= {etimestamp}  {progresssql } ";
                 await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query,
                     requestOptions: new QueryRequestOptions() { MaxItemCount = topcout, PartitionKey = new PartitionKey($"Vote-{code}") }))
                 {