Procházet zdrojové kódy

优化容器合一通过ID查询详情,type值必须传

Li před 3 roky
rodič
revize
44e21b3bd7

+ 2 - 2
TEAMModelBI/Controllers/BICommon/JointlyController.cs

@@ -39,11 +39,11 @@ namespace TEAMModelBI.Controllers.BICommon
         public async Task<IActionResult> GetInfo(JsonElement jsonEmelent)
         {
             if (!jsonEmelent.TryGetProperty("id", out JsonElement id)) return BadRequest();
-            jsonEmelent.TryGetProperty("type", out JsonElement type);
+            if (!jsonEmelent.TryGetProperty("type", out JsonElement type)) return BadRequest();
             jsonEmelent.TryGetProperty("code", out JsonElement code);
             var cosmosClient = _azureCosmos.GetCosmosClient();
             List<object> objs = new List<object>();
-            if (!string.IsNullOrEmpty($"{type}"))
+            if (type.GetInt32() != 0) 
             {
                 await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", _containers[type.GetInt32()]).GetItemQueryStreamIterator(queryText: $"select value(c) from c where c.id='{id}'", requestOptions: string.IsNullOrEmpty($"{code}") ? new QueryRequestOptions() { } : new QueryRequestOptions() { PartitionKey = new PartitionKey($"{code}") }))
                 {