瀏覽代碼

Merge branch 'develop5.0-tmd' of http://106.12.23.251:10000/TEAMMODEL/TEAMModelOS into develop5.0-tmd

zhouj1203@hotmail.com 3 年之前
父節點
當前提交
8e37939c20
共有 1 個文件被更改,包括 8 次插入7 次删除
  1. 8 7
      TEAMModelOS/Controllers/Syllabus/ShareController.cs

+ 8 - 7
TEAMModelOS/Controllers/Syllabus/ShareController.cs

@@ -112,7 +112,8 @@ namespace TEAMModelOS.Controllers
                             return BadRequest();
                         }
                         (Syllabus syllabus, List<Share> shares) = DoAuth(request, syllabusD);
-                        shares.ForEach(async x => {
+                        foreach (var x in shares)
+                        {
                             await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Share>(x, new PartitionKey($"{x.code}"));
                             //发送共编或分享通知
                             Notification notification = new Notification
@@ -120,7 +121,7 @@ namespace TEAMModelOS.Controllers
                                 hubName = "hita",
                                 type = "msg",
                                 from = $"ies5:{request.school}",
-                                to = new List<string>() { x.code.Replace("Share-", "") },
+                                to = new List<string>() { x.code.Replace("Share-", "").Replace($"{x.type}-", "") },
                                 label = $"{x.type}_syllabus",
                                 body = new { biz = x.type, tmdid = x.issuer, tmdname=x.issuerName, schoolcode = $"{request.school}", schoolname = $"{schname}", status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
                                 expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
@@ -130,7 +131,7 @@ namespace TEAMModelOS.Controllers
                             var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
                             var location = _option.Location;
                             var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
-                        });
+                        }
                         await client.GetContainer("TEAMModelOS", "School").UpsertItemAsync<Syllabus>(syllabus, new PartitionKey($"Syllabus-{request.school}"));
 
 
@@ -167,7 +168,7 @@ namespace TEAMModelOS.Controllers
                     else if (request.opt.Equals("add") || request.opt.Equals("edit"))
                     {
                         (Syllabus vlm, List<Share> shares) = DoAuth(request, syllabusD);
-                        shares.ForEach(async x => {
+                        foreach (var x in shares) {
                             await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Share>(x, new PartitionKey($"{x.code}"));
                             //发送共编或分享通知
                             Notification notification = new Notification
@@ -175,9 +176,9 @@ namespace TEAMModelOS.Controllers
                                 hubName = "hita",
                                 type = "msg",
                                 from = $"ies5:private",
-                                to = new List<string>() { x.code.Replace("Share-", "") },
+                                to = new List<string>() { x.code.Replace("Share-", "") .Replace($"{x.type}-", "") },
                                 label = $"{x.type}_syllabus",
-                                body = new { biz = x.type, tmdid = x.issuer, tmdname = x.issuerName,  status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
+                                body = new { biz = x.type, tmdid = x.issuer, tmdname = x.issuerName, status = 1, time = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() }.ToJsonString(),
                                 expires = DateTimeOffset.UtcNow.AddDays(7).ToUnixTimeSeconds()
                             };
                             var url = _configuration.GetValue<string>("HaBookAuth:CoreService:sendnotification");
@@ -185,7 +186,7 @@ namespace TEAMModelOS.Controllers
                             var clientSecret = _configuration.GetValue<string>("HaBookAuth:CoreService:clientSecret");
                             var location = _option.Location;
                             var code = await _notificationService.SendNotification(clientID, clientSecret, location, url, notification);
-                        });
+                        }
                         await client.GetContainer("TEAMModelOS", "Teacher").UpsertItemAsync<Syllabus>(syllabusD, new PartitionKey($"Syllabus-{request.issuer}"));
                     }
                 }