|
@@ -951,9 +951,30 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
Course course = null;
|
|
|
try
|
|
|
{
|
|
|
- course = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<Course>(lessonRecord.courseId, new PartitionKey($"Course-{lessonRecord.school}"));
|
|
|
+ var cresponse = await client.GetContainer(Constant.TEAMModelOS, "School").ReadItemStreamAsync(lessonRecord.courseId, new PartitionKey($"Course-{lessonRecord.school}"));
|
|
|
+ if (cresponse.Status == 200)
|
|
|
+ {
|
|
|
+ using var cJson = await JsonDocument.ParseAsync(cresponse.ContentStream);
|
|
|
+ course = cJson.ToObject<Course>();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ var sresponse = await client.GetContainer(Constant.TEAMModelOS, "Teacher").ReadItemStreamAsync(lessonRecord.courseId, new PartitionKey($"Course-{lessonRecord.tmdid}"));
|
|
|
+ if (sresponse.Status == 200)
|
|
|
+ {
|
|
|
+ using var cJson = await JsonDocument.ParseAsync(sresponse.ContentStream);
|
|
|
+ course = cJson.ToObject<Course>();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ course = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- catch (CosmosException ex) when (ex.Status != 404)
|
|
|
+ catch (Exception ex) {
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}-查询课程-CosmosDB异常{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
+ }
|
|
|
+ /*catch (CosmosException ex) when (ex.Status != 404)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
@@ -963,7 +984,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
|
{
|
|
|
course = null;
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
if (course != null)
|
|
|
{
|
|
|
lessonRecord.periodId = course.period?.id;
|