@@ -22,6 +22,8 @@ using Microsoft.Extensions.Configuration;
using HTEXLib.COMM.Helpers;
using Microsoft.Azure.Functions.Worker;
using TEAMModelOS.SDK.Services;
+using Azure.Storage.Blobs.Models;
+using System.IO;
namespace TEAMModelOS.FunctionV4.ServiceBus
{
@@ -893,12 +895,27 @@ namespace TEAMModelOS.FunctionV4.ServiceBus
var duration = double.Parse($"{update.data}");
lessonRecord.duration = duration;
msgs.Add(update);
+ try {
+ BlobDownloadResult Recording = await _azureStorage.GetBlobContainerClient(blobname).GetBlobClient($"records/{_lessonId}/Record/.Recording.json").DownloadContentAsync();
+ var RecordingJson = JsonDocument.Parse(new MemoryStream(Encoding.UTF8.GetBytes(Recording.Content.ToString()))).RootElement;
+ if (RecordingJson.TryGetProperty("duration",out JsonElement _duration) && _duration.ValueKind.Equals(JsonValueKind.Number)) {
+ var durationFile = double.Parse($"{_duration}");
+ if (duration < durationFile) {
+ lessonRecord.duration = durationFile;
+ }
+ if (RecordingJson.TryGetProperty("streamUrl", out JsonElement _streamUrl) &&!string.IsNullOrWhiteSpace($"{_streamUrl}"))
+ {
+ lessonRecord.hasVideo = 1;
+ } catch (Exception ex ) {
+ await _dingDing.SendBotMsg($"{_option.Location}/LessonRecordEvent/课堂记录更新课堂时长出错records/{_lessonId}/Record/.Recording.json\n{ex.Message}{ex.StackTrace}{msg}", GroupNames.成都开发測試群組);
break;
//更新T分
case "up-tScore":
var tScore = int.Parse($"{update.data}");
lessonRecord.tScore = tScore;
-
//更新课P分
@@ -106,6 +106,7 @@ namespace TEAMModelOS.SDK.Models
/// 0 是否包含视频,1包含视频
/// </summary>
public int hasVideo { get; set; }
+ //public long videoSize { get; set; }
/// <summary>
///
/// 科技互动详细次数。[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49]
@@ -6,10 +6,10 @@ using System.Threading.Tasks;
namespace TEAMModelOS.SDK.Models
- public class NxModel
+ public class OAuthModel
}
- public record NxOauth {
+ public record OAuth {
public string code { get; set; }
public string state { get; set; }
@@ -32,7 +32,7 @@ using Microsoft.AspNetCore.Hosting;
namespace TEAMModelOS.Controllers
// <summary>
- ///
+ /// 标准OAuth2
[ProducesResponseType(StatusCodes.Status200OK)]
@@ -41,7 +41,7 @@ namespace TEAMModelOS.Controllers
//[Route("")]
//[Route("api/[controller]")]
[ApiController]
- public class NxController : ControllerBase
+ public class OAuth2Controller : ControllerBase
private readonly SnowflakeId _snowflakeId;
private readonly AzureCosmosFactory _azureCosmos;
@@ -52,7 +52,6 @@ namespace TEAMModelOS.Controllers
private readonly AzureRedisFactory _azureRedis;
private readonly CoreAPIHttpService _coreAPIHttpService;
private readonly ThirdApisService _scsApisService;
- public readonly string type = "nxedu";
private readonly HttpTrigger _httpTrigger;
private readonly IWebHostEnvironment _environment;
@@ -72,7 +71,7 @@ namespace TEAMModelOS.Controllers
public string _sc_url;
public IConfiguration _configuration { get; set; }
- public NxController(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
+ public OAuth2Controller(IWebHostEnvironment environment, AzureCosmosFactory azureCosmos, SnowflakeId snowflakeId, DingDing dingDing, IOptionsSnapshot<Option> option, AzureStorageFactory azureStorage,
AzureRedisFactory azureRedis, AzureServiceBusFactory serviceBus, IConfiguration configuration, CoreAPIHttpService coreAPIHttpService, ThirdApisService scsApisService, HttpTrigger httpTrigger)
_azureCosmos = azureCosmos;
@@ -90,14 +89,14 @@ namespace TEAMModelOS.Controllers
- /// 动态地址路由。"config":"scsyxpt","path":"sc{pjx/jinniu}"
+ /// 标准OAuth2 方式的回调地址。
/// </summary>D:\VisualStudioProjects\TEAMModelOS\TEAMModelOS.SDK\Models\Service\Third\ScYxptModel.cs
/// <param name="request"></param>
/// <returns></returns>
[HttpGet("{path}/oauth2")]
[AllowAnonymous]
- public async Task<IActionResult> Oauth2([FromQuery] NxOauth oauth2, string path) {
+ public async Task<IActionResult> Oauth2([FromQuery] OAuth oauth2, string path) {
return Ok(new { oauth2, path });
@@ -627,9 +627,15 @@ namespace TEAMModelOS.Controllers
[HttpPost("get-save-log")]
public async Task<IActionResult> SaveLog(JsonElement request)
+
+ BlobDownloadResult Recording = await _azureStorage.GetBlobContainerClient("1595321354").GetBlobClient($"records/271528531841781760/Record/.Recording.json").DownloadContentAsync();
+ var json = Recording.Content.ToString();
+ var jsonByte = Encoding.UTF8.GetBytes(json);
+ Stream stream = new MemoryStream(jsonByte);
+ var doc= JsonDocument.Parse(stream);
School school = await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>("hbcn", new PartitionKey("Base"));
_= _azureStorage.SaveLog("find-school", school.ToJsonString(),httpContext:HttpContext,dingDing:_dingDing,scope:"school");
- return Ok(school);
+ return Ok(new { doc, school, });