|
@@ -1,4 +1,6 @@
|
|
|
-using Microsoft.AspNetCore.Mvc;
|
|
|
+using IES.ExamServer.DI;
|
|
|
+using IES.ExamServer.Models;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
using Microsoft.Extensions.Caching.Memory;
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
using System.Net.Http;
|
|
@@ -15,12 +17,16 @@ namespace IES.ExamServer.Controllers
|
|
|
private readonly IHttpClientFactory _httpClientFactory;
|
|
|
private readonly IMemoryCache _memoryCache;
|
|
|
private readonly ILogger<ManageController> _logger;
|
|
|
- public ManageController(ILogger<ManageController> logger, IConfiguration configuration, IHttpClientFactory httpClientFactory, IMemoryCache memoryCache)
|
|
|
+ private readonly LiteDBFactory _liteDBFactory;
|
|
|
+ private readonly ConnectionService _connectionService;
|
|
|
+ public ManageController(LiteDBFactory liteDBFactory,ILogger<ManageController> logger, IConfiguration configuration, IHttpClientFactory httpClientFactory, IMemoryCache memoryCache, ConnectionService connectionService)
|
|
|
{
|
|
|
_logger = logger;
|
|
|
_configuration=configuration;
|
|
|
_httpClientFactory=httpClientFactory;
|
|
|
_memoryCache=memoryCache;
|
|
|
+ _liteDBFactory=liteDBFactory;
|
|
|
+ _connectionService=connectionService;
|
|
|
}
|
|
|
[HttpPost("download-package")]
|
|
|
public async Task<IActionResult> DownloadPackage(JsonNode json)
|
|
@@ -28,6 +34,15 @@ namespace IES.ExamServer.Controllers
|
|
|
//C#.NET 6 后端与前端流式通信
|
|
|
//https://www.doubao.com/chat/collection/687687510791426?type=Thread
|
|
|
//下载日志记录:1.步骤,检查,2.获取描述信息,3.分类型,4下载文件,5.前端处理,6.返回结果 , 正在下载...==> https://www.doubao.com/chat/collection/687687510791426?type=Thread Ok...
|
|
|
+ string shortCode = $"{json["shortCode"]}";
|
|
|
+ if (string.IsNullOrWhiteSpace(shortCode))
|
|
|
+ {
|
|
|
+ EvaluationClient evaluationClient = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x=>!string.IsNullOrWhiteSpace(x.shortCode) && x.shortCode.Equals(shortCode));
|
|
|
+ if (evaluationClient==null && _connectionService.dataCenterIsConnected)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
return Ok();
|
|
|
}
|
|
|
}
|