Browse Source

活动调整

zhouj1203@hotmail.com 4 years ago
parent
commit
94386d16c6

+ 1 - 1
TEAMModelFunction/model/ExamInfo.cs

@@ -42,7 +42,7 @@ namespace TEAMModelFunction
         public double piont { get; set; }*/
         //指标
         //public double index { get; set; }
-        public long createDate { get; set; }
+        public long createTime { get; set; }
         //public string examCode { get; set; }
         
         /// <summary>

+ 1 - 1
TEAMModelFunction/model/Vote.cs

@@ -52,7 +52,7 @@ namespace TEAMModelFunction
         /// </summary>
         [ProtoMember(6)]
         public long startTime { get; set; }
-        public long createDate { get; set; }
+        public long createTime { get; set; }
 
         /// <summary>
         /// 结束时间

+ 2 - 1
TEAMModelOS/Controllers/Exam/ExamController.cs

@@ -101,11 +101,12 @@ namespace TEAMModelOS.Controllers
             }
             else
             {
-                ExamInfo info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(request.id, new PartitionKey($"{request.code}"));
+                ExamInfo info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<ExamInfo>(request.id, new PartitionKey($"Exam-{request.code}"));
                 if (info.progress.Equals("going"))
                 {
                     return Ok(new { v = "活动正在进行中" });
                 }
+                request.code = info.code;
                 exam = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(request, request.id, new PartitionKey($"{request.code}"));
             }
             //Survey homeWork = await _azureCosmos.SaveOrUpdate<Survey>(request.survey);

+ 3 - 2
TEAMModelOS/Controllers/Task/SurveyController.cs

@@ -89,12 +89,13 @@ namespace TEAMModelOS.Controllers
 
             }
             else {
-                Survey info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(request.survey.id, new PartitionKey($"{request.survey.code}"));
+                Survey info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Survey>(request.survey.id, new PartitionKey($"Survey-{request.survey.code}"));
                 if (info.progress.Equals("going"))
                 {
                     return Ok(new { v = "活动正在进行中" });
                 }
-                survey = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(info, info.id, new PartitionKey($"{info.code}"));
+                request.survey.code = info.code;
+                survey = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(request.survey, info.id, new PartitionKey($"{info.code}"));
                 //request.survey.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
                 /*if (request.survey.scope.Equals("school"))
                 {

+ 3 - 2
TEAMModelOS/Controllers/Task/VoteController.cs

@@ -114,12 +114,13 @@ namespace TEAMModelOS.Controllers.Learn
             }
             else
             {
-                Vote info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(request.vote.id, new PartitionKey($"{request.vote.code}"));
+                Vote info = await client.GetContainer("TEAMModelOS", "Common").ReadItemAsync<Vote>(request.vote.id, new PartitionKey($"Vote-{request.vote.code}"));
                 if (info.progress.Equals("going"))
                 {
                     return Ok(new { v = "活动正在进行中" });
                 }
-                vote = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(info, info.id, new PartitionKey($"{info.code}"));
+                request.vote.code = info.code;
+                vote = await client.GetContainer("TEAMModelOS", "Common").ReplaceItemAsync(request.vote, info.id, new PartitionKey($"{info.code}"));
                 /*if (request.vote.scope.Equals("school"))
                 {
                     vote = await client.GetContainer("TEAMModelOS", "School").ReplaceItemAsync(request.vote, request.vote.id, new PartitionKey($"{request.vote.code}"));