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