Browse Source

update 课堂记录更新

CrazyIter_Bin 3 years ago
parent
commit
9c5ef834a4

+ 1 - 1
TEAMModelOS.FunctionV4/ServiceBus/ActiveTaskTopic.cs

@@ -967,7 +967,7 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
                                 //如果有更新 则去读取/{_lessonId}/IES/base.json
                                 try
                                 {
-                                    BlobDownloadResult baseblobDownload = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"/{_lessonId}/IES/base.json").DownloadContentAsync();
+                                    BlobDownloadResult baseblobDownload = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"/records/{_lessonId}/IES/base.json").DownloadContentAsync();
                                     LessonBase lessonBase = baseblobDownload.Content.ToObjectFromJson<LessonBase>();
                                     if (lessonBase != null  && lessonBase.summary!=null)
                                     {

+ 2 - 2
TEAMModelOS.SDK/Models/Cosmos/Common/LessonRecord.cs

@@ -169,7 +169,7 @@ namespace TEAMModelOS.SDK.Models
         /// <summary>
         /// 学生互动率
         /// </summary>
-        public int clientInteractionAverge { get; set; } = 0;
+        public double clientInteractionAverge { get; set; } = 0;
 
         public int examCount { get; set; }
         public double totalInteractPoint { get; set; } = 0;
@@ -309,7 +309,7 @@ namespace TEAMModelOS.SDK.Models
         /// <summary>
         /// 学生互动率
         /// </summary>
-        public int clientInteractionAverge { get; set; } = 0;
+        public double clientInteractionAverge { get; set; } = 0;
         public int examCount { get; set; }
     }
 

+ 13 - 1
TEAMModelOS/Controllers/Client/HiTeachController.cs

@@ -105,18 +105,30 @@ namespace TEAMModelOS.Controllers.Client
             {
                 LessonRecord lessonRecord = await client.GetContainer(Constant.TEAMModelOS, tbname).ReadItemAsync<LessonRecord>($"{_lessonId}", new PartitionKey(code));
                 List<LessonUpdate> updates = _grant_types.ToObject<List<LessonUpdate>>();
+                bool hasGrant_types = false;
                 if (_grant_types.ValueKind.Equals(JsonValueKind.Array))
                 {
                     if (updates.IsEmpty())
                     {
                         updates.Add(new LessonUpdate { grant_type = "up-base" });
                     }
+                    else {
+                        hasGrant_types = true;
+                    }
                 }
                 else {
                     updates.Add(new LessonUpdate { grant_type = "up-base" });
                 }
                 var ActiveTask = _configuration.GetValue<string>("Azure:ServiceBus:ActiveTask");
-                var messageChange = new ServiceBusMessage(request.ToJsonString());
+                string msg = null;
+                if (hasGrant_types)
+                {
+                    msg = request.ToJsonString();
+                }
+                else {
+                    msg = new { lesson_id = $"{_lessonId}", tmdid = $"{_tmdid}", grant_types = updates, school = $"{_school}", scope = $"{_scope}" }.ToJsonString();
+                }
+                var messageChange = new ServiceBusMessage(msg);
                 messageChange.ApplicationProperties.Add("name", "LessonRecordEvent");
                 await _serviceBus.GetServiceBusClient().SendMessageAsync(ActiveTask, messageChange);
                 return Ok(new { status = 200 });

+ 1 - 1
TEAMModelOS/Controllers/System/BlobController.cs

@@ -132,7 +132,7 @@ namespace TEAMModelOS.Controllers
             }
             else
             {
-                return BadRequest("文件名错误");
+                return Ok(new BlobAuth { url=$"{azureBlobSAS}",sas="",name = $"{azureBlobSAS}" });
             };
         }