Jelajahi Sumber

册别更新保存课纲章节的id集合顺序。

CrazyIter_Bin 4 tahun lalu
induk
melakukan
6753df54bd

+ 3 - 1
TEAMModelOS.SDK/Models/Cosmos/Common/Volume.cs

@@ -82,7 +82,9 @@ namespace TEAMModelOS.SDK.Models.Cosmos.Common
         /// </summary>
         [Required(ErrorMessage = "scope 必须设置")]
         public string scope { get; set; }
-       
+
+        public List<string> syllabusIds { get; set; } = new List<string>();
+
     }
 
 }

+ 0 - 43
TEAMModelOS/Controllers/Syllabus/VolumeController.cs

@@ -107,54 +107,15 @@ namespace TEAMModelOS.Controllers
                 //私有课纲
                 if (scope.GetString()== "private")
                 {
-                    //await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher").GetItemQueryStreamIterator(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Syllabus-{code}") }))
-                    //{
-                    //    using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                    //    if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                    //    {
-                    //        foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                    //        {
-                    //            syllabuses.Add(obj.ToObject<Syllabus>());
-                    //        }
-                    //    }
-                    //}
                     await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<Volume>(queryText: $"select value(c) from c where c.status = {status}", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Volume-{code}") }))
                     {
                         volumes.Add(item);
-                        //using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                        //if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                        //{
-                        //    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                        //    {
-                        //        volumes.Add(obj.ToObject<Volume>());
-                        //    }
-                        //}
                     }
                 }
                 else if(scope.GetString() == "school") {
-                    //await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: $"select value(c) from c ", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Syllabus-{code}") }))
-                    //{
-                    //    using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                    //    if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                    //    {
-                    //        foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                    //        {
-                    //            syllabuses.Add(obj.ToObject<Syllabus>());
-                    //        }
-                    //    }
-                    //}
                     await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "School").GetItemQueryIterator<Volume>(queryText: $"select value(c) from c where c.status = {status} and c.periodId = '{periodCode}' and c.subjectId = '{subjectCode}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Volume-{code}") }))
                     {
                         volumes.Add(item);
-
-                        //using var json = await JsonDocument.ParseAsync(item.ContentStream);
-                        //if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
-                        //{
-                        //    foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
-                        //    {
-                        //        volumes.Add(obj.ToObject<Volume>());
-                        //    }
-                        //}
                     }
                 }
              }
@@ -217,13 +178,9 @@ namespace TEAMModelOS.Controllers
                 try {
                     if (request.scope.Equals("school"))
                     {
-                      //  Volume volume = await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "School").ReadItemAsync<Volume>(request.id, new PartitionKey(request.code));
-                        //保留授权
                         await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "School").ReplaceItemAsync<Volume>(request, request.id, new Azure.Cosmos.PartitionKey(request.code));
                     }
                     else if (request.scope.Equals("private")) {
-                       // Volume volume = await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher").ReadItemAsync<Volume>(request.id, new PartitionKey(request.code));
-                        //保留授权
                         await _azureCosmos.GetCosmosClient().GetContainer("TEAMModelOS", "Teacher").ReplaceItemAsync<Volume>(request, request.id, new Azure.Cosmos.PartitionKey(request.code));
                     }