|
@@ -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));
|
|
|
}
|
|
|
|