CrazyIter_Bin 3 years ago
parent
commit
15c6b06979
1 changed files with 4 additions and 6 deletions
  1. 4 6
      TEAMModelOS/Services/Common/ActivityStudentService.cs

+ 4 - 6
TEAMModelOS/Services/Common/ActivityStudentService.cs

@@ -374,17 +374,16 @@ namespace TEAMModelOS.Services.Common
                     userType = usertype.GetString();
                 }
             }
-
+            string stimesql = "";
             //开始时间,默认最近三十天
-            var stimestamp = DateTimeOffset.UtcNow.AddDays(-30).ToUnixTimeMilliseconds();
             if (request.TryGetProperty("stime", out JsonElement stime))
             {
                 if (!stime.ValueKind.Equals(JsonValueKind.Undefined) && !stime.ValueKind.Equals(JsonValueKind.Null) && stime.TryGetInt64(out long data))
                 {
-                    stimestamp = data;
+                    stimesql = $" and  c.startTime >= {data}  ";
                 }
             }
-            string stimesql = $" c.startTime >= {stimestamp}  ";
+           
             //默认当前时间,  未开始的不能查询
             var etimestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
             string etimesql = $" and c.startTime <= {etimestamp}   ";
@@ -424,7 +423,6 @@ namespace TEAMModelOS.Services.Common
 
                 }
             }
-          
             //科目
             string joinSqlSubjects = "";
             string andSqlSubjects = "";
@@ -457,7 +455,7 @@ namespace TEAMModelOS.Services.Common
                 containerId = "Student";
                 PartitionKey = $"Activity-{id}";
             }
-            string querySchool = $" SELECT distinct  value c   FROM c   {joinSqlSubjects}  where {stimesql}  {etimesql} and c.pk='Activity'   {typesql}  {andSqlSubjects}  ";
+            string querySchool = $" SELECT distinct  value c   FROM c   {joinSqlSubjects}  where c.pk='Activity' {stimesql}  {etimesql}      {typesql}  {andSqlSubjects}  ";
             //查询数据归属学校的
             await foreach (var item in client.GetContainer(Constant.TEAMModelOS, containerId).GetItemQueryStreamIterator(querySchool, continuationToken: continuationToken,
                 requestOptions: new QueryRequestOptions() { MaxItemCount = topcout, PartitionKey = new PartitionKey(PartitionKey) }))