Browse Source

投票查询

CrazyIter_Bin 4 years ago
parent
commit
f56d45e4b5
1 changed files with 8 additions and 8 deletions
  1. 8 8
      TEAMModelOS/Controllers/Common/VoteController.cs

+ 8 - 8
TEAMModelOS/Controllers/Common/VoteController.cs

@@ -118,17 +118,17 @@ namespace TEAMModelOS.Controllers.Learn
                 if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
                 //开始时间,默认最近三十天
                 var stimestamp = DateTimeOffset.UtcNow.AddDays(-30).ToUnixTimeMilliseconds();
-                if (!requert.TryGetProperty("stime", out JsonElement stime)) {
-                    if (stime.TryGetInt64(out long data))
+                if (requert.TryGetProperty("stime", out JsonElement stime)) {
+                    if (!stime.ValueKind.Equals(JsonValueKind.Undefined)&&stime.TryGetInt64(out long data))
                     {
                         stimestamp = data;
                     };
                 };
                 //默认当前时间
                 var etimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
-                if (!requert.TryGetProperty("etime", out JsonElement etime))
+                if (requert.TryGetProperty("etime", out JsonElement etime))
                 {
-                    if (stime.TryGetInt64(out long data))
+                    if (!etime.ValueKind.Equals(JsonValueKind.Undefined)&&etime.TryGetInt64(out long data))
                     {
                         etimestamp = data;
                     };
@@ -138,8 +138,8 @@ namespace TEAMModelOS.Controllers.Learn
                 string continuationToken = null;
                 //默认不指定返回大小
                 int? topcout=null;
-                if (!requert.TryGetProperty("count", out JsonElement jcount)) {
-                    if(jcount.TryGetInt32(out int data))
+                if (requert.TryGetProperty("count", out JsonElement jcount)) {
+                    if(!jcount.ValueKind.Equals(JsonValueKind.Undefined) && jcount.TryGetInt32(out int data))
                     {
                         topcout = data;
                     };
@@ -147,10 +147,10 @@ namespace TEAMModelOS.Controllers.Learn
                 //是否需要进行分页查询,默认不分页
                 bool iscontinuation = false;
                 //如果指定了返回大小
-                if (!requert.TryGetProperty("continuationToken", out JsonElement continuation))
+                if (requert.TryGetProperty("continuationToken", out JsonElement continuation))
                 {
                     //指定了cancellationToken 表示需要进行分页
-                    if (!continuation.ValueKind.Equals(JsonValueKind.Null) && !continuation.ValueKind.Equals(JsonValueKind.String))
+                    if (!continuation.ValueKind.Equals(JsonValueKind.Null) && !continuation.ValueKind.Equals(JsonValueKind.Undefined))
                     {
                         continuationToken = continuation.GetString();
                         iscontinuation = true;