zhouj1203@hotmail.com 1 year ago
parent
commit
708d995c3a
1 changed files with 27 additions and 8 deletions
  1. 27 8
      TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

+ 27 - 8
TEAMModelOS.FunctionV4/CosmosDB/TriggerExam.cs

@@ -1587,22 +1587,25 @@ namespace TEAMModelOS.FunctionV4
                         index_json = await _azureStorage.GetBlobContainerClient($"{info.creatorId}").GetBlobClient($"{info.papers[no].blob}/index.json").DownloadContentAsync();
                     }
                     //BlobDownloadResult index_json = await _azureStorage.GetBlobContainerClient($"{info.school}").GetBlobClient($"{info.papers[no].blob}/index.json").DownloadContentAsync();
-                    JObject jo = JObject.Parse(index_json.Content.ToString());
-                    JArray array = jo.Value<JArray>("slides");
+                    //JObject jo = JObject.Parse(new MemoryStream(Encoding.UTF8.GetBytes(index_json.Content.ToString())).ToString());
+                    JsonElement RecordingJson = JsonDocument.Parse(new MemoryStream(Encoding.UTF8.GetBytes(index_json.Content.ToString()))).RootElement;
+                    RecordingJson.TryGetProperty("slides", out JsonElement slides);
+                    var sdes = slides.ToObject<List<Slides>>();
                     List<string> attachments = new List<string>();
                     if (info.qamode == 1) {
-                        attachments = jo.Value<JArray>("attachments")?.ToObject<List<string>>();
+                        attachments = RecordingJson.GetProperty("attachments").ToObject<List<string>>();
                         if (attachments.Count == 0)
                         {
                             return;
                         }
                     }
                     List<string> urls = new();
-                    foreach (var ne in array)
+                  
+                    foreach (var ne in sdes)
                     {
-                        if (!ne["type"].ToString().Equals("compose"))
+                        if (!ne.type.Equals("compose"))
                         {
-                            urls.Add(ne["url"].ToString());
+                            urls.Add(ne.url);
                         }
                     }
                     
@@ -1693,12 +1696,12 @@ namespace TEAMModelOS.FunctionV4
                         if(location.Equals("China")) //大陸正式站
                         {
                             urlAction = "https://malearn.teammodel.cn";
-                            accessKey = "QUzQqbqbnLsTDTeaJy4Br6wUuqPoAlKpzRK2S6PGImRHAzFuySGAeA==";
+                            accessKey = "2BcXFR_hvzG1pZjqIkaM7Dx74Hcu6m0PwwOacFpDpq44AzFuHJBRXA==";
                         }
                         else if(location.Equals("China-Dep") || location.Equals("China-Test")) //大陸測試站
                         {
                             urlAction = "https://malearn-rc.teammodel.cn";
-                            accessKey = "hESc0g7Q60FTEss4ZnVXPB61S1a8WlAXIq5ULl3T3oTxAzFunpLDwA==";
+                            accessKey = "lghWhJduNiAlo-e8isqEoROjdR7DAC-50XNtanIwHKYlAzFu1aog_A==";
                         }                        
                     }
                     else if (location.Contains("Global"))
@@ -1741,5 +1744,21 @@ namespace TEAMModelOS.FunctionV4
             public int total { get; set; }
             public double qrate { get; set; }
         }
+
+        public class Slides
+        {
+            public string url { get; set; }
+            public string type { get; set; }
+            public Scoring scoring { get; set; } = new Scoring();
+        }
+
+        public class Scoring
+        {
+            public double score { get; set; }
+            public List<string> knowledge { get; set; } = new List<string>();
+            public int field { get; set; } = new();
+            public List<string> ans { get; set; } = new List<string>();
+        }
+
     }
 }