|
@@ -24,6 +24,7 @@ using Microsoft.Azure.Functions.Worker;
|
|
using TEAMModelOS.SDK.Services;
|
|
using TEAMModelOS.SDK.Services;
|
|
using Azure.Storage.Blobs.Models;
|
|
using Azure.Storage.Blobs.Models;
|
|
using System.IO;
|
|
using System.IO;
|
|
|
|
+using Azure;
|
|
|
|
|
|
namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
{
|
|
{
|
|
@@ -960,30 +961,9 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
msgs.Add(update);
|
|
msgs.Add(update);
|
|
break;
|
|
break;
|
|
//更新 基础统计信息
|
|
//更新 基础统计信息
|
|
- case "up-base":
|
|
|
|
- try {
|
|
|
|
- BlobDownloadResult baseblobDownload = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"/{_lessonId}/IES/base.json").DownloadContentAsync();
|
|
|
|
- LessonBase lessonBase = baseblobDownload.Content.ToObjectFromJson<LessonBase>();
|
|
|
|
- if (lessonBase != null) {
|
|
|
|
- lessonRecord.attendCount = lessonRecord.attendCount;
|
|
|
|
- lessonRecord.clientCount = lessonRecord.clientCount;
|
|
|
|
- lessonRecord.attendRate = lessonRecord.attendRate;
|
|
|
|
- lessonRecord.groupCount = lessonRecord.groupCount;
|
|
|
|
- lessonRecord.collateTaskCount = lessonRecord.collateTaskCount;
|
|
|
|
- lessonRecord.collateCount = lessonRecord.collateCount;
|
|
|
|
- lessonRecord.pushCount = lessonRecord.pushCount;
|
|
|
|
- lessonRecord.totalPoint = lessonRecord.totalPoint;
|
|
|
|
- lessonRecord.examQuizCount = lessonRecord.examQuizCount;
|
|
|
|
- lessonRecord.interactionCount = lessonRecord.interactionCount;
|
|
|
|
- lessonRecord.examPointRate = lessonRecord.examPointRate;
|
|
|
|
- lessonRecord.clientInteractionCount = lessonRecord.clientInteractionCount;
|
|
|
|
- lessonRecord.clientInteractionAverge = lessonRecord.clientInteractionAverge;
|
|
|
|
- }
|
|
|
|
- msgs.Add(update);
|
|
|
|
- } catch (Exception ex) {
|
|
|
|
- await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}课程读取base.json,{_lessonId}\n{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
|
- }
|
|
|
|
- break;
|
|
|
|
|
|
+ //case "up-base":
|
|
|
|
+
|
|
|
|
+ // break;
|
|
|
|
|
|
//更新 时间线
|
|
//更新 时间线
|
|
case "up-TimeLine":
|
|
case "up-TimeLine":
|
|
@@ -1112,6 +1092,36 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
|
|
}
|
|
}
|
|
//如果被删除则不能再被更新
|
|
//如果被删除则不能再被更新
|
|
if (isReplace) {
|
|
if (isReplace) {
|
|
|
|
+ //如果有更新 则去读取/{_lessonId}/IES/base.json
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ BlobDownloadResult baseblobDownload = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"/{_lessonId}/IES/base.json").DownloadContentAsync();
|
|
|
|
+ LessonBase lessonBase = baseblobDownload.Content.ToObjectFromJson<LessonBase>();
|
|
|
|
+ if (lessonBase != null)
|
|
|
|
+ {
|
|
|
|
+ lessonRecord.attendCount = lessonRecord.attendCount;
|
|
|
|
+ lessonRecord.clientCount = lessonRecord.clientCount;
|
|
|
|
+ lessonRecord.attendRate = lessonRecord.attendRate;
|
|
|
|
+ lessonRecord.groupCount = lessonRecord.groupCount;
|
|
|
|
+ lessonRecord.collateTaskCount = lessonRecord.collateTaskCount;
|
|
|
|
+ lessonRecord.collateCount = lessonRecord.collateCount;
|
|
|
|
+ lessonRecord.pushCount = lessonRecord.pushCount;
|
|
|
|
+ lessonRecord.totalPoint = lessonRecord.totalPoint;
|
|
|
|
+ lessonRecord.examQuizCount = lessonRecord.examQuizCount;
|
|
|
|
+ lessonRecord.interactionCount = lessonRecord.interactionCount;
|
|
|
|
+ lessonRecord.examPointRate = lessonRecord.examPointRate;
|
|
|
|
+ lessonRecord.clientInteractionCount = lessonRecord.clientInteractionCount;
|
|
|
|
+ lessonRecord.clientInteractionAverge = lessonRecord.clientInteractionAverge;
|
|
|
|
+ }
|
|
|
|
+ msgs.Add(new LessonUpdate { grant_type = "up-base" });
|
|
|
|
+ }
|
|
|
|
+ catch (RequestFailedException ex) when (ex.Status == 404)
|
|
|
|
+ {
|
|
|
|
+ msgs.Add(new LessonUpdate { grant_type = "up-base-404" });
|
|
|
|
+ }
|
|
|
|
+ catch (Exception ex) {
|
|
|
|
+ await _dingDing.SendBotMsg($"{Environment.GetEnvironmentVariable("Option:Location")}课程读取base.json,{_lessonId}\n{ex.Message}\n{ex.StackTrace}", GroupNames.成都开发測試群組);
|
|
|
|
+ }
|
|
await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(lessonRecord, lessonId, new PartitionKey(code));
|
|
await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, tbname).ReplaceItemAsync<LessonRecord>(lessonRecord, lessonId, new PartitionKey(code));
|
|
}
|
|
}
|
|
//计算课堂更新前后的差值
|
|
//计算课堂更新前后的差值
|