|
@@ -64,14 +64,14 @@ namespace IES.ExamServer.Controllers
|
|
|
//下载日志记录:1.步骤,检查,2.获取描述信息,3.分类型,4下载文件,5.前端处理,6.返回结果 , 正在下载...==> [INFO]https://www.doubao.com/chat/collection/687687510791426?type=Thread [Size=180kb] Ok...
|
|
|
//进度条 展示下载文件总大小和已下载,末尾展示 文件总个数和已下载个数
|
|
|
//https://cdnjs.cloudflare.com/ajax/libs/microsoft-signalr/8.0.7/signalr.min.js
|
|
|
- /* int data = 0,blob=0,webview=0, groupList=0
|
|
|
+ /* int data = 0,blob=0, groupList=0
|
|
|
{
|
|
|
"evaluationId":"idssss",
|
|
|
"shortCode":"1234567890",
|
|
|
"ownerId":"hbcn/tmdid",
|
|
|
"data":1,
|
|
|
"blob":1,
|
|
|
- "webview":1,
|
|
|
+
|
|
|
"groupList":1
|
|
|
}
|
|
|
*/
|
|
@@ -119,10 +119,7 @@ namespace IES.ExamServer.Controllers
|
|
|
{
|
|
|
await httpClient.GetAsync($"{url}/{cnt}/exam/{json["evaluationId"]}/paper");
|
|
|
}
|
|
|
- if ($"{json["webview"]}".Equals("1"))
|
|
|
- {
|
|
|
- //await httpClient.GetAsync($"{url}/{cnt}/exam/{json["evaluationId"]}/evaluation.json");
|
|
|
- }
|
|
|
+ //下载完成后,对数据进行检查,然后在加密压缩。
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -132,7 +129,7 @@ namespace IES.ExamServer.Controllers
|
|
|
[AuthToken("admin", "teacher", "visitor")]
|
|
|
public async Task<IActionResult> CheckEvaluation(JsonNode json)
|
|
|
{
|
|
|
- string shortCode = $"{json["shortCode"]}";
|
|
|
+ string shortCode = $"{json["c"]}";
|
|
|
string evaluationId = $"{json["evaluationId"]}";
|
|
|
string checkCenter = $"{json["checkCenter"]}";
|
|
|
string deviceId = $"{json["deviceId"]}";
|
|
@@ -314,15 +311,43 @@ namespace IES.ExamServer.Controllers
|
|
|
|
|
|
//校验本地文件数据
|
|
|
string packagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "package");
|
|
|
+ string zipPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "zip");
|
|
|
if (!Directory.Exists(packagePath))
|
|
|
{
|
|
|
Directory.CreateDirectory(packagePath);
|
|
|
}
|
|
|
+ //判断文件包的压缩包是否存在。
|
|
|
+ if (!System.IO.File.Exists(Path.Combine(zipPath, $"{evaluationLocal.id}-{evaluationLocal}.zip")))
|
|
|
+ {
|
|
|
+ blob=1;//压缩包不存在
|
|
|
+ msg_status=Constant._Message_status_error;
|
|
|
+ checkTotal++;
|
|
|
+ checkError++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ msg_status=Constant._Message_status_success;
|
|
|
+ checkTotal++;
|
|
|
+ checkSuccess++;
|
|
|
+ //解压操作。
|
|
|
+ var extractRes= ZipHelper.ExtractPasswordProtectedZip(Path.Combine(zipPath, $"{evaluationLocal.id}-{evaluationLocal}.zip"), packagePath, evaluationLocal.openCode!);
|
|
|
+ if (extractRes.res)
|
|
|
+ {
|
|
|
+ checkTotal++;
|
|
|
+ checkSuccess++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ blob=1;//压缩包错误
|
|
|
+ msg_status=Constant._Message_status_error;
|
|
|
+ checkTotal++;
|
|
|
+ checkError++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
string evaluationPath = Path.Combine(packagePath, evaluationLocal.id!);
|
|
|
string evaluationDataPath = Path.Combine(evaluationPath, "data");
|
|
|
- // await Task.Delay(DelayMacro);
|
|
|
-
|
|
|
- //await Task.Delay(DelayMacro);
|
|
|
+
|
|
|
string path_groupList = Path.Combine(evaluationDataPath, "groupList.json");
|
|
|
msg_status =Constant._Message_status_info;
|
|
|
if (!System.IO.File.Exists(path_groupList))
|
|
@@ -591,8 +616,17 @@ namespace IES.ExamServer.Controllers
|
|
|
checkWarning,
|
|
|
});
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ /// <summary>
|
|
|
+ /// 设置评测开考信息(本轮名单,)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="json"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("setting-evaluation")]
|
|
|
+ [AuthToken("admin", "teacher", "visitor")]
|
|
|
+ public IActionResult SettingEvaluation(JsonNode json)
|
|
|
+ {
|
|
|
+ return Ok();
|
|
|
+ }
|
|
|
|
|
|
/// <summary>
|
|
|
/// 激活或者取消激活考试
|
|
@@ -604,31 +638,40 @@ namespace IES.ExamServer.Controllers
|
|
|
public IActionResult ActivateEvaluation(JsonNode json)
|
|
|
{
|
|
|
string id = $"{json["id"]}";
|
|
|
- string shortCode = $"{json["shortCode"]}";
|
|
|
+ string openCode = $"{json["openCode"]}";
|
|
|
string activateStr = $"{json["activate"]}";
|
|
|
- if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(shortCode))
|
|
|
+ if (!string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(openCode))
|
|
|
{
|
|
|
- EvaluationClient? evaluationClient = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x => x.id!.Equals(id) && !string.IsNullOrWhiteSpace(x.shortCode) && x.shortCode.Equals(shortCode));
|
|
|
+ EvaluationClient? evaluationClient = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x => x.id!.Equals(id) && !string.IsNullOrWhiteSpace(x.openCode) && x.openCode.Equals(openCode));
|
|
|
if (evaluationClient != null)
|
|
|
{
|
|
|
- IEnumerable<EvaluationClient> evaluationClients = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Find(x=>x.activate==1);
|
|
|
- if (evaluationClients != null && evaluationClients.Count() > 0)
|
|
|
+ IEnumerable<EvaluationClient> evaluationClients = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Find(x => x.activate==1);
|
|
|
+ if (evaluationClients != null && evaluationClients.Count() > 0)
|
|
|
{
|
|
|
- foreach(EvaluationClient item in evaluationClients)
|
|
|
+ foreach (EvaluationClient item in evaluationClients)
|
|
|
{
|
|
|
item.activate = 0;
|
|
|
_liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Upsert(item);
|
|
|
}
|
|
|
}
|
|
|
int activate = 0;
|
|
|
- if (int.TryParse(activateStr, out int _activate)) {
|
|
|
+ if (int.TryParse(activateStr, out int _activate))
|
|
|
+ {
|
|
|
activate = _activate;
|
|
|
}
|
|
|
evaluationClient.activate = activate;
|
|
|
_liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Upsert(evaluationClient);
|
|
|
+ return Ok(new { code = 200, msg = "操作成功!" });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return Ok(new { code = 400, msg = "未找到匹配的评测!" });
|
|
|
}
|
|
|
}
|
|
|
- return Ok();
|
|
|
+ else {
|
|
|
+ return Ok(new { code = 400, msg = "参数错误!" });
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 加载本地的活动列表
|
|
@@ -650,7 +693,7 @@ namespace IES.ExamServer.Controllers
|
|
|
var anonymousObject = new Dictionary<string, object?>();
|
|
|
foreach (var property in properties)
|
|
|
{
|
|
|
- if (!property.Name.Equals("password") && !property.Name.Equals("openCode"))
|
|
|
+ if (!property.Name.Equals("openCode"))
|
|
|
{
|
|
|
anonymousObject[property.Name] = property.GetValue(client);
|
|
|
}
|
|
@@ -660,7 +703,7 @@ namespace IES.ExamServer.Controllers
|
|
|
return Ok(new { code = 200, evaluation = result });
|
|
|
}
|
|
|
else {
|
|
|
- return Ok(new { code = 200, evaluation = new Dictionary<string, object?>() });
|
|
|
+ return Ok(new { code = 200, evaluation = new List<EvaluationClient> ()});
|
|
|
}
|
|
|
|
|
|
}
|