Переглянути джерело

批量设置学校集合中学校多个管理员

Li 2 роки тому
батько
коміт
0fa737a1b1

+ 4 - 3
TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs

@@ -1301,6 +1301,7 @@ namespace TEAMModelBI.Controllers.BISchool
         /// <param name="jsonElement"></param>
         /// <returns></returns>
         [ProducesDefaultResponseType]
+        [AuthToken(Roles = "admin")]
         [HttpPost("batch-scmanage")]
         public async Task<IActionResult> BatchScManage(JsonElement jsonElement) 
         {
@@ -1313,7 +1314,7 @@ namespace TEAMModelBI.Controllers.BISchool
             foreach (var item in scManages)
             {
                 School school = new();
-                var resSc = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(item.id, new PartitionKey("Base"));
+                var resSc = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync($"{item.id}", new PartitionKey("Base"));
                 if (resSc.Status == 200)
                 {
                     using var sJson = await JsonDocument.ParseAsync(resSc.ContentStream);
@@ -1325,7 +1326,7 @@ namespace TEAMModelBI.Controllers.BISchool
                     Teacher teacher = new();
                     foreach (var tmd in tmdInfos)
                     {
-                        var respone = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemStreamAsync(tmd.id, new PartitionKey("Base"));
+                        var respone = await cosmosClient.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemStreamAsync($"{tmd.id}", new PartitionKey("Base"));
                         if (respone.Status == 200)
                         {
                             using var tchJson = await JsonDocument.ParseAsync(respone.ContentStream);
@@ -1387,7 +1388,7 @@ namespace TEAMModelBI.Controllers.BISchool
                             {
                                 id = $"{tmd.id}",
                                 name = $"{tmd.name}",
-                                picture = tmd.picture,
+                                picture = $"{tmd.picture}",
                                 pk = "Base",
                                 code = "Base",
                                 size = 1,