CrazyIter_Bin před 3 měsíci
rodič
revize
af2556e6d9

+ 206 - 103
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Controllers/ManageController.cs

@@ -12,6 +12,7 @@ using Microsoft.AspNetCore.SignalR;
 using Microsoft.Extensions.Caching.Memory;
 using Microsoft.Extensions.Configuration;
 using System;
+using System.Diagnostics.Eventing.Reader;
 using System.Linq.Expressions;
 using System.Net.Http;
 using System.Net.Http.Json;
@@ -27,7 +28,7 @@ namespace IES.ExamServer.Controllers
 {
     [ApiController]
     [Route("manage")]
-    public class ManageController:BaseController
+    public class ManageController : BaseController
     {
         private readonly IConfiguration _configuration;
         private readonly IHttpClientFactory _httpClientFactory;
@@ -38,7 +39,7 @@ namespace IES.ExamServer.Controllers
         private readonly int DelayMicro = 10;//微观数据延迟
         private readonly int DelayMacro = 100;//宏观数据延迟
         private readonly IHubContext<SignalRExamServerHub> _signalRExamServerHub;
-        public ManageController(LiteDBFactory liteDBFactory,ILogger<ManageController> logger, IConfiguration configuration,
+        public ManageController(LiteDBFactory liteDBFactory, ILogger<ManageController> logger, IConfiguration configuration,
             IHttpClientFactory httpClientFactory, IMemoryCache memoryCache, CenterServiceConnectionService connectionService, IHubContext<SignalRExamServerHub> signalRExamServerHub)
         {
             _logger = logger;
@@ -51,7 +52,7 @@ namespace IES.ExamServer.Controllers
         }
         ///通过线上回传数据需要鉴权验证等操作。
         ///通过离线包回传数据需要加密操作
-        
+
         /// <summary>
         /// 清理缓存,列出缓存占用空间,type =list列出,type=clear清理,不能清理近期及正在激活的数据,并且提示清理中暂未上传或者导出的数据。
         /// </summary>
@@ -59,31 +60,38 @@ namespace IES.ExamServer.Controllers
         /// <returns></returns>
         [HttpPost("clean-cache")]
         [AuthToken("admin", "teacher", "visitor")]
-        public async Task<IActionResult> CleanCache(JsonNode json) 
+        public async Task<IActionResult> CleanCache(JsonNode json)
         {
             return Ok();
         }
+
+        //C#.NET 6 后端与前端流式通信
+        //https://www.doubao.com/chat/collection/687687510791426?type=Thread
+        //下载日志记录: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, groupList=0
+         {
+            "evaluationId":"idssss",
+            "shortCode":"1234567890",
+            "ownerId":"hbcn/tmdid",
+            "data":1,
+            "blob":1,
+            "groupList":1
+        }
+         */
+        //如果要访问中心,则需要教师登录联网。  
+
         [HttpPost("download-package")]
         [AuthToken("admin", "teacher", "visitor")]
         public async Task<IActionResult> DownloadPackage(JsonNode json)
         {
-            //C#.NET 6 后端与前端流式通信
-            //https://www.doubao.com/chat/collection/687687510791426?type=Thread
-            //下载日志记录: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, groupList=0
-             {
-                "evaluationId":"idssss",
-                "shortCode":"1234567890",
-                "ownerId":"hbcn/tmdid",
-                "data":1,
-                "blob":1,
-                "groupList":1
-            }
-             */
-            //如果要访问中心,则需要教师登录联网。  
             var token = GetAuthTokenInfo();
+
+            //检查试卷文件完整性
+            List<string> successMsgs = new List<string>();
+            List<string> errorMsgs = new List<string>();
+            EvaluationCheckFileResult result = new EvaluationCheckFileResult() { successMsgs=successMsgs, errorMsgs=errorMsgs };
             if (token.scope.Equals(ExamConstant.ScopeTeacher) || token.scope.Equals(ExamConstant.ScopeVisitor))
             {
                 if (_connectionService.centerIsConnected)
@@ -91,6 +99,7 @@ namespace IES.ExamServer.Controllers
                     Teacher? teacher = _liteDBFactory.GetLiteDatabase().GetCollection<Teacher>().FindOne(x => x.id!.Equals(token.id));
                     string id = $"{json["evaluationId"]}";
                     string shortCode = $"{json["shortCode"]}";
+                    string deviceId = $"{json["deviceId"]}";
                     EvaluationClient? evaluationClient = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x => x.id!.Equals(id) && x.shortCode!.Equals(shortCode));
                     if (teacher != null && evaluationClient!= null)
                     {
@@ -101,7 +110,7 @@ namespace IES.ExamServer.Controllers
                             client.DefaultRequestHeaders.Remove(Constant._X_Auth_AuthToken);
                         }
                         client.DefaultRequestHeaders.Add(Constant._X_Auth_AuthToken, teacher.x_auth_token);
-                        HttpResponseMessage message = await client.PostAsJsonAsync($"{CenterUrl}/blob/sas-read", new { containerName = $"{json["ownerId"]}" });
+                        HttpResponseMessage message = await client.PostAsJsonAsync($"{CenterUrl}/blob/sas-read", new { containerName = $"{evaluationClient.ownerId}" });
                         string sas = string.Empty;
                         string url = string.Empty;
                         string cnt = string.Empty;
@@ -120,50 +129,69 @@ namespace IES.ExamServer.Controllers
                         var httpClient = _httpClientFactory.CreateClient();
                         string packagePath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "package");
                         string evaluationPath = Path.Combine(packagePath, evaluationClient.id!);
+                        //删除文件夹
+                        FileHelper.DeleteFolder(evaluationPath);
                         string evaluationDataPath = Path.Combine(evaluationPath, "data");
                         if (!Directory.Exists(evaluationDataPath))
                         {
                             Directory.CreateDirectory(evaluationDataPath);
                         }
+
                         string evaluationData = string.Empty;
-                        if ($"{json["data"]}".Equals("1"))
                         {
+                            //evaluation
+                            string evaluationUrl = $"{url}/{cnt}/package/{json["evaluationId"]}/data/evaluation.json?{sas}";
+                            HttpResponseMessage dataMessage = await httpClient.GetAsync(evaluationUrl);
+                            if (dataMessage.IsSuccessStatusCode)
                             {
-                                string evaluationUrl = $"{url}/{cnt}/package/{json["evaluationId"]}/data/evaluation.json?{sas}";
-                                HttpResponseMessage dataMessage = await httpClient.GetAsync(evaluationUrl);
                                 var content = await dataMessage.Content.ReadAsStringAsync();
                                 evaluationData=content;
                                 string path_evaluation = Path.Combine(evaluationDataPath, "evaluation.json");
                                 await System.IO.File.WriteAllTextAsync(path_evaluation, content);
+                                successMsgs.Add("评测信息文件evaluation.json文件下载成功!");
+                            }
+                            else
+                            {
+                                errorMsgs.Add("评测信息文件evaluation.json文件下载失败!");
+                            }
 
 
-                            }
+                        }
+                        {
+                            //source.json
+                            string sourceUrl = $"{url}/{cnt}/package/{json["evaluationId"]}/data/source.json?{sas}";
+                            HttpResponseMessage dataMessage = await httpClient.GetAsync(sourceUrl);
+                            if (dataMessage.IsSuccessStatusCode)
                             {
-                                //source.json
-                                string sourceUrl = $"{url}/{cnt}/package/{json["evaluationId"]}/data/source.json?{sas}";
-                                HttpResponseMessage dataMessage = await httpClient.GetAsync(sourceUrl);
                                 var content = await dataMessage.Content.ReadAsStringAsync();
                                 string path_source = Path.Combine(evaluationDataPath, "source.json");
                                 await System.IO.File.WriteAllTextAsync(path_source, content);
+                                successMsgs.Add("评测数据原始文件source.json文件下载成功!");
+                            }
+                            else
+                            {
+                                errorMsgs.Add("评测数据原始文件source.json文件下载失败!");
                             }
                         }
-                        if ($"{json["groupList"]}".Equals("1"))
                         {
+                            //grouplist.json
                             string grouplistUrl = $"{url}/{cnt}/package/{json["evaluationId"]}/data/grouplist.json?{sas}";
                             HttpResponseMessage groupListMessage = await httpClient.GetAsync(grouplistUrl);
-                            var content = await groupListMessage.Content.ReadAsStringAsync();
-                            string path_groupList = Path.Combine(evaluationDataPath, "grouplist.json");
-                            await System.IO.File.WriteAllTextAsync(path_groupList, content);
-                        }
-                        if ($"{json["blob"]}".Equals("1"))
-                        {
-                            if (string.IsNullOrEmpty(evaluationData))
+                            if (groupListMessage.IsSuccessStatusCode)
                             {
-                                string evaluationUrl = $"{url}/{cnt}/package/{json["evaluationId"]}/data/evaluation.json?{sas}";
-                                HttpResponseMessage dataMessage = await httpClient.GetAsync(evaluationUrl);
-                                var content = await dataMessage.Content.ReadAsStringAsync();
-                                evaluationData=content;
+                                var content = await groupListMessage.Content.ReadAsStringAsync();
+                                string path_groupList = Path.Combine(evaluationDataPath, "grouplist.json");
+                                await System.IO.File.WriteAllTextAsync(path_groupList, content);
+                                successMsgs.Add("评测名单grouplist.json文件下载成功!");
+                            }
+                            else
+                            {
+                                errorMsgs.Add("评测名单grouplist.json文件下载失败!");
                             }
+                        }
+
+                        {
+                            //下载试卷文件
                             List<EvaluationExam>? evaluationExams = evaluationData.ToObject<JsonNode>()?["evaluationExams"]?.ToObject<List<EvaluationExam>>();
                             foreach (var evaluationExam in evaluationExams!)
                             {
@@ -175,7 +203,7 @@ namespace IES.ExamServer.Controllers
                                         Directory.CreateDirectory(path_paper);
                                     }
                                     //最多开启10个线程并行下载
-                                    var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = 10 };
+                                    var parallelOptions = new ParallelOptions { MaxDegreeOfParallelism = 20 };
                                     // 使用 Parallel.ForEachAsync 并行处理每个 blob
                                     await Parallel.ForEachAsync(evaluationPaper.blobs, parallelOptions, async (blob, cancellationToken) =>
                                     {
@@ -186,17 +214,17 @@ namespace IES.ExamServer.Controllers
                                             if (blobMessage.IsSuccessStatusCode)
                                             {
                                                 byte[] bytes = await blobMessage.Content.ReadAsByteArrayAsync(cancellationToken);
-                                                string? fileName = Path.GetFileName(blob.path);
-                                                string? fileNameWithoutExtension = Path.GetFileNameWithoutExtension(blob.path);
                                                 string? extension = Path.GetExtension(blob.path);
                                                 if (extension!=null)
                                                 {
                                                     if (extension.Equals(extension.ToUpper()))
                                                     {
+                                                        string? fileNameWithoutExtension = Path.GetFileNameWithoutExtension(blob.path);
                                                         await System.IO.File.WriteAllBytesAsync(Path.Combine(path_paper, $"{fileNameWithoutExtension!}_1{extension}"), bytes, cancellationToken);
                                                     }
                                                     else
                                                     {
+                                                        string? fileName = Path.GetFileName(blob.path);
                                                         await System.IO.File.WriteAllBytesAsync(Path.Combine(path_paper, fileName!), bytes, cancellationToken);
                                                     }
                                                 }
@@ -204,71 +232,65 @@ namespace IES.ExamServer.Controllers
                                             else
                                             {
                                                 string? error = await blobMessage.Content.ReadAsStringAsync(cancellationToken);
-                                                Console.WriteLine($"Error downloading {blob.path},{blobMessage.StatusCode},{error}");
+                                                errorMsgs.Add($"{evaluationExam.subjectName},{evaluationPaper.paperName},{blob.path}文件下载失败,{blobMessage.StatusCode},{error}");
+                                                // Console.WriteLine($"Error downloading {blob.path},{blobMessage.StatusCode},{error}");
                                             }
                                         }
                                         catch (Exception ex)
                                         {
+                                            errorMsgs.Add($"{evaluationExam.subjectName},{evaluationPaper.paperName},{blob.path}文件下载错误,{ex.Message}");
                                             // 处理异常
-                                            Console.WriteLine($"Error downloading {blob.path}: {ex.Message}");
+                                            //Console.WriteLine($"Error downloading {blob.path}: {ex.Message}");
                                         }
                                     });
                                 }
                             }
-                            //foreach (var evaluationExam in evaluationExams!)
-                            //{
-                            //    foreach (var evaluationPaper in evaluationExam.papers)
-                            //    {
-                            //        string path_paper = Path.Combine(evaluationPath, $"papers/{evaluationPaper.paperId}");
-                            //        if (!Directory.Exists(path_paper))
-                            //        {
-                            //            Directory.CreateDirectory(path_paper);
-                            //        }
-                            //        foreach (var blob in evaluationPaper.blobs)
-                            //        {
-                            //            HttpResponseMessage blobMessage = await httpClient.GetAsync($"{url}/{cnt}/{blob.path}?{sas}");
-
-                            //            byte[] bytes = await blobMessage.Content.ReadAsByteArrayAsync();
-
-                            //            string? path = blob.path;
-                            //            string? fileName = Path.GetFileName(path);
-                            //            if (fileName!=null)
-                            //            {
-                            //                await System.IO.File.WriteAllBytesAsync(Path.Combine(path_paper, fileName), bytes);
-                            //            }
-
-                            //        }
-                            //    }
-                            //}
                         }
 
+                        (successMsgs, errorMsgs) = await ManageService.CheckFile(evaluationClient, successMsgs, errorMsgs, _signalRExamServerHub, _memoryCache, _logger, deviceId, evaluationPath);
                         //下载完成后,对数据进行检查,然后在加密压缩。
                         string zipPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "zip");
                         if (!Directory.Exists(zipPath))
                         {
                             Directory.CreateDirectory(zipPath);
                         }
-                        //判断文件包的压缩包是否存在。
                         string zipFilePath = Path.Combine(zipPath, $"{evaluationClient.id}-{evaluationClient.blobHash}.zip");
-                        ZipHelper.CreatePasswordProtectedZip(evaluationPath, zipFilePath, evaluationClient.openCode!);
-                        return Ok(new { code = 200, msg = "下载成功!", url = zipFilePath });
+                        var zipInfo = ZipHelper.CreatePasswordProtectedZip(evaluationPath, zipFilePath, evaluationClient.openCode!);
+                        if (zipInfo.res)
+                        {
+                            successMsgs.Add("评测数据压缩包创建成功!");
+                        }
+                        else {
+                            errorMsgs.Add("评测数据压缩包创建失败!");
+                        }
+
                     }
                     else
                     {
                         string teacherMsg = teacher==null ? "未找到教师信息" : "";
                         string evaluationMsg = evaluationClient==null ? "未找到评测信息" : "";
-                        return Ok(new { code = 1, msg = $"用户信息或未找到评测信息!{teacherMsg}{evaluationMsg}" });
+                        errorMsgs.Add($"用户信息或未找到评测信息!{teacherMsg}{evaluationMsg}");
                     }
                 }
-                else { 
-                    return Ok(new { code = 2, msg = "云端数据中心未连接" });
+                else {
+                    errorMsgs.Add($"云端数据中心未连接");
                 }
             }
             else
             {
-                return Ok(new { code = 3, msg = "请使用教师或访客账号登录!" });
+                errorMsgs.Add($"请使用教师或访客账号登录!");
             }
-           
+            result.checkError=result.errorMsgs.Count();
+            result.checkSuccess=result.successMsgs.Count();
+            result.checkTotal=result.checkSuccess+result.checkError;
+            if (result.errorMsgs.Count()==0)
+            {
+                return Ok(new { code = 200, msg = "下载成功!", result });
+            }
+            else {
+                return Ok(new { code = 1, msg = "下载失败!", result });
+            }
+
         }
 
         /// <summary>
@@ -284,15 +306,15 @@ namespace IES.ExamServer.Controllers
             string evaluationId = $"{json["evaluationId"]}";
             string openCode = $"{json["openCode"]}";
             var token = GetAuthTokenInfo();
-            int checkTotal = 0, checkSuccess = 0, checkError = 0;
-            List<string> msgs = new List<string>();
-            EvaluationCheckFileResult evaluationCheckFileResult = new EvaluationCheckFileResult();
+            List<string> successMsgs = new List<string>();
+            List<string> errorMsgs = new List<string>();
+            EvaluationCheckFileResult result = new EvaluationCheckFileResult() { successMsgs=successMsgs, errorMsgs  =errorMsgs };
             if (!string.IsNullOrEmpty(openCode) &&  !string.IsNullOrEmpty(evaluationId))
             {
-                EvaluationClient? evaluationLocal = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x=>x.id!.Equals(evaluationId) && x.openCode!.Equals(openCode));
+                EvaluationClient? evaluationLocal = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x => x.id!.Equals(evaluationId) && x.openCode!.Equals(openCode));
                 if (evaluationLocal!=null)
                 {
-                  
+
                     await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                         new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType=Constant._Message_type_message, status=0, content="开始检查评测信息文件.." });
                     //判断文件包的压缩包是否存在。
@@ -302,6 +324,7 @@ namespace IES.ExamServer.Controllers
                     string evaluationPath = Path.Combine(packagePath, evaluationLocal.id!);
                     if (System.IO.File.Exists(Path.Combine(zipPath, $"{evaluationLocal.id}-{evaluationLocal.blobHash}.zip")))
                     {
+                        successMsgs.Add("加载评测试卷文件包!");
                         //删除文件夹
                         FileHelper.DeleteFolder(evaluationPath);
                         if (!Directory.Exists(evaluationPath))
@@ -310,20 +333,46 @@ namespace IES.ExamServer.Controllers
                         }
                         //解压文件包
                         var extractRes = ZipHelper.ExtractPasswordProtectedZip(Path.Combine(zipPath, $"{evaluationLocal.id}-{evaluationLocal.blobHash}.zip"), evaluationPath, evaluationLocal.openCode!);
-                        if (extractRes.res) 
+                        if (extractRes.res)
                         {
-                            evaluationCheckFileResult=  await ManageService.CheckFile(evaluationLocal, msgs,_signalRExamServerHub,_memoryCache,_logger, deviceId,evaluationPath);
+                            successMsgs.Add("评测试卷文件包解压成功!");
+                            (successMsgs, errorMsgs) =  await ManageService.CheckFile(evaluationLocal, successMsgs, errorMsgs, _signalRExamServerHub, _memoryCache, _logger, deviceId, evaluationPath);
                         }
+                        else {
+                            errorMsgs.Add("评测试卷文件包解压失败!");
+                            //return Ok(new { code = 3, msg = "评测试卷文件包解压失败!" });
+                        }
+                    }
+                    else {
+                        errorMsgs.Add("评测试卷文件包不存在!");
+                        //return Ok(new { code = 3, msg = "评测试卷文件包不存在!" });
                     }
                 }
+                else {
+                    errorMsgs.Add("未找到评测信息!");
+                    // return Ok(new { code = 2, msg = "未找到评测信息!" });
+                }
             }
             else
             {
-                return Ok(new { code = 400, msg = "评测ID或提取码均未填写!" });
+                errorMsgs.Add("评测ID或提取码均未填写!");
+                // return Ok(new { code = 1, msg = "评测ID或提取码均未填写!" });
             }
-            return Ok(new { result=evaluationCheckFileResult, code = 200, msgs });
+
+            result.checkTotal = result.errorMsgs.Count() + result.successMsgs.Count();
+            result.checkError= result.errorMsgs.Count();
+            result.checkSuccess = result.successMsgs.Count();
+            if (result.errorMsgs.Count()==0)
+            {
+                return Ok(new { code = 200, msg = "校验成功!", result });
+            }
+            else
+            {
+                return Ok(new { code = 1, msg = "校验失败!", result });
+            }
+
         }
-        
+
         [HttpPost("check-evaluation")]
         [AuthToken("admin", "teacher", "visitor")]
         public async Task<IActionResult> CheckEvaluation(JsonNode json)
@@ -358,7 +407,8 @@ namespace IES.ExamServer.Controllers
             {
                 evaluationLocal= evaluationClients.First();
             }
-            List<string> msgs = new List<string>();
+            List<string> successMsgs = new List<string>();
+            List<string> errorMsgs = new List<string>();
             //从数据中心搜索
             if ("1".Equals($"{checkCenter}"))
             {
@@ -422,24 +472,32 @@ namespace IES.ExamServer.Controllers
                     centerCode = $"404";
                     centerMsg = "云端数据中心未连接";
                 }
-                msgs.Add($"云端数据检测结果:{centerMsg},状态:{centerCode}");
+                if (centerCode.Equals("200"))
+                {
+                    successMsgs.Add($"云端数据检测结果:{centerMsg},状态:{centerCode}");
+                }
+                else
+                {
+                    errorMsgs.Add($"云端数据检测结果:{centerMsg},状态:{centerCode}");
+                }
+
             }
-            var checkDataResult = ManageService.CheckData(evaluationLocal, evaluationCloud, msgs, _liteDBFactory);
-            Dictionary<string, object?>? evaluation =null;
+            var checkDataResult = ManageService.CheckData(evaluationLocal, evaluationCloud, successMsgs, errorMsgs, _liteDBFactory);
+            Dictionary<string, object?>? evaluation = null;
             if (evaluationLocal!=null)
             {
                 string zipPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "zip");
                 //判断文件包的压缩包是否存在。
                 if (!System.IO.File.Exists(Path.Combine(zipPath, $"{evaluationLocal.id}-{evaluationLocal.blobHash}.zip")))
                 {
-                    checkDataResult. zip =1;
+                    checkDataResult.zip =1;
                     checkDataResult.blob=1;
                     checkDataResult.data=1;
                     checkDataResult.groupList=1;
                     checkDataResult.blobSize=evaluationLocal.blobSize;
                     checkDataResult.dataSize=evaluationLocal.dataSize;
                     checkDataResult.studentCount=evaluationLocal.studentCount;
-                    msgs.Add($"评测文件包压缩包不存在,需要重新下载评测!");
+                    errorMsgs.Add($"评测文件包压缩包不存在,需要重新下载评测!");
 
                 }
                 var properties = evaluationLocal.GetType().GetProperties();
@@ -452,16 +510,51 @@ namespace IES.ExamServer.Controllers
                     }
                 }
             }
-            
+
             return Ok(new
             {
                 code = 200,
                 evaluation = evaluation,
-                result= checkDataResult
+                result = checkDataResult
             });
         }
 
-        
+        /// <summary>
+        /// 获取当前评测的开考设置信息
+        /// </summary>
+        /// <param name="json"></param>
+        /// <returns></returns>
+        [HttpPost("load-evaluation-round-setting")]
+        [AuthToken("admin", "teacher", "visitor")]
+        public IActionResult LoadEvaluationRoundSetting(JsonNode json)
+        {
+            EvaluationClient? evaluationClient = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x => x.id!.Equals(json["evaluationId"]));
+            EvaluationRoundSetting? setting = null;
+            if (evaluationClient!=null)
+            {
+                if (string.IsNullOrWhiteSpace(evaluationClient.roundId))
+                {
+                    setting =  _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationRoundSetting>().FindOne(x => x.id!.Equals(evaluationClient.roundId));
+                }
+
+                if (setting!=null)
+                {
+                    return Ok(new
+                    {
+                        code = 200,
+                        setting = setting
+                    });
+                }
+                else
+                {
+                    return Ok(new { code = 2, msg = "未设置开考信息!" });
+                }
+            }
+            else {
+                return Ok(new { code = 1, msg = "未找到评测信息!" });
+            }
+        }
+
 
         /// <summary>
         /// 设置评测开考信息(本轮名单,计时规则等)
@@ -470,13 +563,13 @@ namespace IES.ExamServer.Controllers
         /// <returns></returns>
         [HttpPost("setting-evaluation-round")]
         [AuthToken("admin", "teacher", "visitor")]
-        public IActionResult SettingEvaluationRound(JsonNode json) 
+        public IActionResult SettingEvaluationRound(JsonNode json)
         {
             EvaluationRoundSetting? setting = json.ToObject<EvaluationRoundSetting>();
-            if (setting!=null  )
+            if (setting!=null)
             {
-                EvaluationClient? evaluationClient = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x => x.id!.Equals(setting.evaluationId));
-                if (evaluationClient!=null) 
+                EvaluationClient? evaluationClient = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().FindOne(x => x.id!.Equals(setting.evaluationId) && x.openCode!.Equals(json["openCode"])&& x.shortCode!.Equals(json["shortCode"]));
+                if (evaluationClient!=null)
                 {
                     IEnumerable<EvaluationClient> evaluationClients = _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Find(x => x.activate==1);
                     if (evaluationClients != null && evaluationClients.Count() > 0)
@@ -497,15 +590,25 @@ namespace IES.ExamServer.Controllers
                         evaluationClient.startline = setting.startline;
                         evaluationClient.activate = setting.activate;
                         //增加排序,保证id的唯一性
-                        setting.id=ShaHashHelper.GetSHA1($"{evaluationClient.id}_{string.Join("", setting.groupList.Select(x => x.id)).OrderBy(x=>x)}");
+                        setting.id=ShaHashHelper.GetSHA1($"{evaluationClient.id}_{string.Join("", setting.groupList.Select(x => x.id)).OrderBy(x => x)}");
+                        setting.createTime= DateTimeOffset.Now.ToUnixTimeMilliseconds();
                         evaluationClient.roundId = setting.id;
                         _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationRoundSetting>().Upsert(setting);
                         _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Upsert(evaluationClient);
                         return Ok(new { code = 200, msg = "操作成功!" });
                     }
+                    else
+                    {
+                        return Ok(new { code = 3, msg = "开考名单不在当前评测中!" });
+                    }
                 }
+                else { return Ok(new { code = 2, msg = "未找到评测,请确认评测ID、提取码、开卷码是否正确!" }); }
             }
-            return Ok(new { code = 1, msg = "操作失败!" });
+            else
+            {
+                return Ok(new { code = 1, msg = "未完善设置信息!" });
+            }
+            
         }
        
         /// <summary>

+ 9 - 5
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Controllers/StudentController.cs

@@ -108,7 +108,12 @@ namespace IES.ExamServer.Controllers
                         }
                         if (setting!=null)
                         {
-                            (code ,msg)= CheckActivate(evaluationClient);
+                            (code ,msg)= CheckActivate(evaluationClient, setting);
+                            evaluationClient.countdownType = setting.countdownType;
+                            evaluationClient.countdown = setting.countdown;
+                            evaluationClient.deadline = setting.deadline;
+                            evaluationClient.startline = setting.startline;
+                            evaluationClient.activate = setting.activate;
                             var anonymousObject = new Dictionary<string, object?>();
                             var properties = evaluationClient.GetType().GetProperties();
                             foreach (var property in properties)
@@ -118,7 +123,6 @@ namespace IES.ExamServer.Controllers
                                     anonymousObject[property.Name] = property.GetValue(evaluationClient);
                                 }
                             }
-
                             return Ok(new { evaluationClient = anonymousObject, code = 200, msg = msg });
                         }
                         else 
@@ -138,7 +142,7 @@ namespace IES.ExamServer.Controllers
             return Ok(new { msg ,code});
         }
 
-        private (int code, string msg) CheckActivate(EvaluationClient evaluationClient)
+        private (int code, string msg) CheckActivate(EvaluationClient evaluationClient, EvaluationRoundSetting setting)
         {
             code = 200;
             if (evaluationClient.scope!.Equals("school"))
@@ -151,14 +155,14 @@ namespace IES.ExamServer.Controllers
             }
             //当前时间
             long now = DateTimeOffset.Now.ToUnixTimeMilliseconds();
-            if (evaluationClient.countdownType>0)
+            if (setting.countdownType>0)
             {
                 if (evaluationClient.startline>now || evaluationClient.stime>now)
                 {
                     msg="评测暂未开始。";
                     code=4;
                 }
-                if ((evaluationClient.deadline>0 && evaluationClient.deadline<now)|| evaluationClient.etime<now)
+                if ((setting.deadline>0 && setting.deadline<now)|| evaluationClient.etime<now)
                 {
                     msg="评测已经结束。";
                     code=5;

+ 7 - 7
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Helpers/ZipHelper.cs

@@ -46,12 +46,12 @@ namespace IES.ExamServer.Helpers
         /// <param name="zipFilePath">生成的 ZIP 文件路径</param>
         /// <param name="password">ZIP 文件密码</param>
         /// <returns>是否成功</returns>
-        public static bool CreatePasswordProtectedZip(string sourceDirectory, string zipFilePath, string password)
+        public static (bool res, string msg) CreatePasswordProtectedZip(string sourceDirectory, string zipFilePath, string password)
         {
             if (!Directory.Exists(sourceDirectory))
             {
-                Console.WriteLine("源目录不存在。");
-                return false;
+               // Console.WriteLine("源目录不存在。");
+                return (false, "源目录不存在。");
             }
 
             try
@@ -65,13 +65,13 @@ namespace IES.ExamServer.Helpers
                     CompressFolder(sourceDirectory, zipStream, "");
                 }
 
-                Console.WriteLine($"ZIP 文件已成功创建:{zipFilePath}");
-                return true;
+                //Console.WriteLine($"ZIP 文件已成功创建:{zipFilePath}");
+                return (true, $"ZIP 文件已成功创建")  ;
             }
             catch (Exception ex)
             {
-                Console.WriteLine($"创建 ZIP 文件时发生错误:{ex.Message}");
-                return false;
+              // Console.WriteLine($"创建 ZIP 文件时发生错误:{ex.Message}");
+                return (false, $"创建 ZIP 文件时发生错误!");
             }
         }
 

+ 91 - 63
TEAMModelOS.Extension/IES.Exam/IES.ExamServer/Services/ManageService.cs

@@ -5,6 +5,7 @@ using IES.ExamServer.Helpers;
 using IES.ExamServer.Models;
 using Microsoft.AspNetCore.SignalR;
 using Microsoft.Extensions.Caching.Memory;
+using System.IO;
 using System.Text.Json.Nodes;
 using System.Text.RegularExpressions;
 
@@ -20,61 +21,71 @@ namespace IES.ExamServer.Services
         /// <param name="msgs"></param>
         /// <param name="_liteDBFactory"></param>
         /// <returns></returns>
-        public async static Task<EvaluationCheckFileResult> CheckFile(EvaluationClient evaluationLocal, List<string> msgs, IHubContext<SignalRExamServerHub> _signalRExamServerHub, 
+        public async static Task<(List<string> successMsgs, List<string> errorMsgs)> CheckFile(EvaluationClient evaluationLocal, List<string> successMsgs,List<string> errorMsgs, IHubContext<SignalRExamServerHub> _signalRExamServerHub, 
             IMemoryCache _memoryCache, ILogger _logger, string deviceId,string evaluationPath)
         {
            
         
             int msg_status = Constant._Message_status_info;
             string content = msg_status.Equals(Constant._Message_status_success) ? "成功" : "失败";
-            int checkTotal = 0, checkSuccess = 0, checkError = 0;
+           
             if (!Directory.Exists(evaluationPath)) 
             {
-                checkTotal++;
-                checkError++;
-                msgs.Add($"评测目录不存在:{evaluationPath}");
+                
+                errorMsgs.Add($"评测目录不存在:{evaluationPath}");
             }
             else
             {
-                checkTotal++;
-                checkSuccess++;
                 string evaluationDataPath = Path.Combine(evaluationPath, "data");
                 string path_groupList = Path.Combine(evaluationDataPath, "groupList.json");
                 msg_status =Constant._Message_status_info;
                 if (!System.IO.File.Exists(path_groupList))
                 {
                     msg_status=Constant._Message_status_error;
-                    checkTotal++;
-                    checkError++;
                 }
                 else
                 {
                     msg_status=Constant._Message_status_success;
-                    checkTotal++;
-                    checkSuccess++;
+                   
+                    
                 }
                 await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                     new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content="评测名单文件(groupList.json)" });
                 content = msg_status.Equals(Constant._Message_status_success) ? "成功" : "失败";
-                msgs.Add($"评测名单文件(groupList.json),检测结果:{content}");
+                if (msg_status.Equals(Constant._Message_status_success)|| msg_status.Equals(Constant._Message_status_info))
+                {
+                    successMsgs.Add($"评测名单文件(groupList.json),检测结果:{content}");
+                }
+                else 
+                {
+                    errorMsgs.Add($"评测名单文件(groupList.json),检测结果:{content}");
+                }
                 string path_source = Path.Combine(evaluationDataPath, "source.json");
                 msg_status = Constant._Message_status_info;
                 if (!System.IO.File.Exists(path_source))
                 {
                     msg_status=Constant._Message_status_error;
-                    checkTotal++;
-                    checkError++;
+                   
+                   
                 }
                 else
                 {
                     msg_status=Constant._Message_status_success;
-                    checkTotal++;
-                    checkSuccess++;
+                   
+                    
                 }
                 await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                     new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content="评测原始数据(source.json)" });
                 content = msg_status.Equals(Constant._Message_status_success) ? "成功" : "失败";
-                msgs.Add($"评测原始数据(source.json),检测结果:{content}");
+               
+                if (msg_status.Equals(Constant._Message_status_success)|| msg_status.Equals(Constant._Message_status_info))
+                {
+                    successMsgs.Add($"评测原始数据(source.json),检测结果:{content}");
+                }
+                else
+                {
+                    errorMsgs.Add($"评测原始数据(source.json),检测结果:{content}");
+                }
                 msg_status =Constant._Message_status_info;
                 try
                 {
@@ -83,14 +94,14 @@ namespace IES.ExamServer.Services
                     if (!System.IO.File.Exists(path_evaluation))
                     {
                         msg_status=Constant._Message_status_error;
-                        checkTotal++;
-                        checkError++;
+                       
+                       
                     }
                     else
                     {
                         msg_status=Constant._Message_status_success;
-                        checkTotal++;
-                        checkSuccess++;
+                       
+                        
                     }
                     //数据格式:  [消息][信息/错误/警告][15:43]=>[开始检查评测信息文件...]
                     //数据格式:  [检查][成功/失败][15:43]=>[评测数据文件:/wwwroot/package/623a9fe6-5445-0938-ff77-aeb80066ef27/evaluation.json]
@@ -98,30 +109,37 @@ namespace IES.ExamServer.Services
                     await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                         new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content="评测数据文件(evaluation.json)" });
                     content = msg_status.Equals(Constant._Message_status_success) ? "成功" : "失败";
-                    msgs.Add($"评测数据文件(evaluation.json),检测结果:{content}");
+                    if (msg_status.Equals(Constant._Message_status_success)|| msg_status.Equals(Constant._Message_status_info))
+                    {
+                        successMsgs.Add($"评测数据文件(evaluation.json),检测结果:{content}");
+                    }
+                    else
+                    {
+                        errorMsgs.Add($"评测数据文件(evaluation.json),检测结果:{content}");
+                    }
                     if (System.IO.File.Exists(path_evaluation))
                     {
                         string evaluation_str = await System.IO.File.ReadAllTextAsync(path_evaluation);
                         JsonNode? evaluation_data = evaluation_str.ToObject<JsonNode>();
                         if (evaluation_data==null)
                         {
-                            checkTotal++;
-                            checkError++;
+                           
+                           
                             msg_status=Constant._Message_status_error;
                             await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                                 new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content="评测数据文件(evaluation.json),文件读取失败!" });
-                            msgs.Add("评测数据文件(evaluation.json),文件读取失败!");
+                            errorMsgs.Add("评测数据文件(evaluation.json),文件读取失败!");
                         }
                         else
                         {
                             EvaluationClient? evaluationClient = evaluation_data["evaluationClient"]?.ToObject<EvaluationClient>();
                             if (evaluationClient!=null)
                             {
-                                checkTotal++;
-                                checkSuccess++;
+                               
+                                
                                 await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                                     new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType=Constant._Message_type_message, status=msg_status, content="评测数据文件(evaluation.json),读取评测基本信息..." });
-                                msgs.Add($"评测数据文件(evaluation.json),读取评测基本信息...");
+                                successMsgs.Add($"评测数据文件(evaluation.json),读取评测基本信息...");
                                 if (!string.IsNullOrWhiteSpace(evaluationLocal.blobHash) && evaluationLocal.blobHash.Equals(evaluationClient.blobHash)
                                     &&(evaluationLocal.blobTime==evaluationClient.blobTime)
                                     &&(evaluationLocal.blobCount== evaluationClient.blobCount)
@@ -130,58 +148,57 @@ namespace IES.ExamServer.Services
                                     &&(evaluationLocal.dataSize==evaluationClient.dataSize)
                                     )
                                 {
-                                    checkTotal++;
-                                    checkSuccess++;
                                     msg_status=Constant._Message_status_info;
                                 }
                                 else
                                 {
-                                    checkTotal++;
-                                    checkError++;
                                     msg_status=Constant._Message_status_error;
                                 }
 
                                 await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                                     new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType=Constant._Message_type_message, status=msg_status, content="评测数据文件(evaluation.json),校验评测基本信息..." });
                                 content = msg_status.Equals(Constant._Message_status_success)||msg_status.Equals(Constant._Message_status_info) ? "成功" : "失败";
-                                msgs.Add($"评测数据文件(evaluation.json),校验评测基本信息,检测结果:{content}");
+                                if (msg_status.Equals(Constant._Message_status_success)|| msg_status.Equals(Constant._Message_status_info))
+                                {
+                                    successMsgs.Add($"评测数据文件(evaluation.json),校验评测基本信息,检测结果:{content}");
+                                }
+                                else
+                                {
+                                    errorMsgs.Add($"评测数据文件(evaluation.json),校验评测基本信息,检测结果:{content}"); ;
+                                }
                             }
                             else
                             {
-                                checkTotal++;
-                                checkError++;
+                               
+                               
                                 msg_status=Constant._Message_status_error;
                                 await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                                 new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType= Constant._Message_type_check, status=msg_status, content="评测数据文件(evaluation.json),读取评测基本信息失败!" });
-                                msgs.Add("评测数据文件(evaluation.json),读取评测基本信息失败!");
+                                errorMsgs.Add("评测数据文件(evaluation.json),读取评测基本信息失败!");
                             }
 
                             List<EvaluationExam>? evaluationExams = evaluation_data["evaluationExams"]?.ToObject<List<EvaluationExam>>();
                             if (evaluationExams.IsEmpty())
                             {
-                                checkTotal++;
-                                checkError++;
+                               
+                               
                                 msg_status=Constant._Message_status_error;
                                 content = msg_status.Equals(Constant._Message_status_success)||msg_status.Equals(Constant._Message_status_info) ? "成功" : "失败";
-                                msgs.Add($"评测数据文件(evaluation.json),读取评测试卷信息失败");
+                                errorMsgs.Add($"评测数据文件(evaluation.json),读取评测试卷信息失败");
                             }
                             else
                             {
-                                checkTotal++;
-                                checkSuccess++;
                                 msg_status=Constant._Message_status_info;
                                 await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                                     new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType=Constant._Message_type_message, status=msg_status, content="评测数据文件(evaluation.json),读取评测试卷信息..." });
-                                msgs.Add($"评测数据文件(evaluation.json),读取评测试卷信息...");
+                                successMsgs.Add($"评测数据文件(evaluation.json),读取评测试卷信息...");
                                 string pattern = @"paper/[^/]+/([^/]+/[^/]+\.[^/]+)";
                                 foreach (var evaluationExam in evaluationExams!)
                                 {
-                                    checkTotal++;
-                                    checkSuccess++;
                                     msg_status=Constant._Message_status_info;
                                     await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                                         new MessageContent { dataId=evaluationLocal.id, dataName=evaluationLocal.name, messageType=Constant._Message_type_message, status=msg_status, content=$"校验评测科目试卷:{evaluationExam.subjectName}-{evaluationExam.examName}" });
-                                    msgs.Add($"校验评测科目试卷:{evaluationExam.subjectName}-{evaluationExam.examName}");
+                                    successMsgs.Add($"校验评测科目试卷:{evaluationExam.subjectName}-{evaluationExam.examName}");
                                     string path_papers = Path.Combine(evaluationPath, "papers");
                                     var papers_files = FileHelper.ListAllFiles(path_papers);
                                     int paperIndex = 0;
@@ -200,6 +217,14 @@ namespace IES.ExamServer.Services
                                                 if (match.Success)
                                                 {
                                                     string result = match.Groups[1].Value.Replace("/", "\\");
+                                                    
+                                                    string extension = Path.GetExtension(result);
+                                                    if (extension.Equals(extension.ToUpper()))
+                                                    {
+                                                        string fileName = Path.GetFileNameWithoutExtension(result);
+                                                        result= $"{fileName!}_1{extension}";
+                                                    }
+                                                    
                                                     var file = papers_files.Find(x => x.Contains(result));
                                                     if (file!=null)
                                                     {
@@ -210,20 +235,23 @@ namespace IES.ExamServer.Services
                                                     {
                                                         msg_status=Constant._Message_status_error;
                                                         blob_error_count++;
+                                                        errorMsgs.Add($"试卷名称:[{paperIndex}]{evaluationExam.examName}-{evaluationExam.subjectName}-{paper.paperName},未匹配到本地文件:{blobInfo.path}");
                                                     }
-
                                                 }
                                                 else
                                                 {
                                                     msg_status=Constant._Message_status_error;
                                                     blob_error_count++;
+                                                    errorMsgs.Add($"试卷名称:[{paperIndex}]{evaluationExam.examName}-{evaluationExam.subjectName}-{paper.paperName},未提取到正则匹配的文件:{blobInfo.path}");
                                                 }
                                             }
                                             else
                                             {
                                                 msg_status=Constant._Message_status_error; ;
                                                 blob_error_count++;
+                                                errorMsgs.Add($"试卷名称:[{paperIndex}]{evaluationExam.examName}-{evaluationExam.subjectName}-{paper.paperName},文件路径为空:{blobInfo.ToJsonString()}");
                                             }
+                                           
                                             contents.Add(new MessageContent
                                             {
                                                 dataId=evaluationLocal.id,
@@ -237,10 +265,12 @@ namespace IES.ExamServer.Services
                                         if (blob_error_count>0)
                                         {
                                             paper_msg_status=Constant._Message_status_error;
+                                            errorMsgs.Add($"试卷名称:[{paperIndex}]{evaluationExam.examName}-{evaluationExam.subjectName}-{paper.paperName},文件数量:{paper.blobs.Count()},检测成功数量:{contents.Count(x => x.status==Constant._Message_status_success)},检测异常数量{contents.Count(x => x.status==Constant._Message_status_error)}");
                                         }
                                         else
                                         {
                                             paper_msg_status=Constant._Message_status_success;
+                                            successMsgs.Add($"试卷名称:[{paperIndex}]{evaluationExam.examName}-{evaluationExam.subjectName}-{paper.paperName},文件数量:{paper.blobs.Count()},检测成功数量:{contents.Count(x => x.status==Constant._Message_status_success)},检测异常数量{contents.Count(x => x.status==Constant._Message_status_error)}");
                                         }
                                         await _signalRExamServerHub.SendMessage(_memoryCache, _logger, deviceId, Constant._Message_grant_type_check_file,
                                             new MessageContent
@@ -252,26 +282,22 @@ namespace IES.ExamServer.Services
                                                 content=$"试卷名称:[{paperIndex}]{evaluationExam.examName}-{evaluationExam.subjectName}-{paper.paperName},文件数量:{paper.blobs.Count()},检测成功数量:{contents.Count(x => x.status==Constant._Message_status_success)},检测异常数量{contents.Count(x => x.status==Constant._Message_status_error)}",
                                                 contents=contents
                                             });
-                                        checkTotal++;
-                                        checkSuccess++;
-                                        content = paper_msg_status.Equals(Constant._Message_status_success)||msg_status.Equals(Constant._Message_status_info) ? "成功" : "失败";
-                                        msgs.Add($"试卷名称:[{paperIndex}]{evaluationExam.examName}-{evaluationExam.subjectName}-{paper.paperName},文件数量:{paper.blobs.Count()},检测成功数量:{contents.Count(x => x.status==Constant._Message_status_success)},检测异常数量{contents.Count(x => x.status==Constant._Message_status_error)}");
                                     }
                                 }
                             }
                         }
                     }
-                    
                 }
                 catch (Exception e)
                 {
+                    errorMsgs.Add($"校验评测试卷文件信息异常:{e.Message}");
                     _logger.LogData<object>(new { code = 500, msg = e.Message, data = new { content = e.StackTrace } }, evaluationLocal.id!);
                 }
             }
-            return new EvaluationCheckFileResult { checkTotal = checkTotal, checkSuccess = checkSuccess, checkError = checkError, msgs = msgs };
+            return (successMsgs , errorMsgs);
         }
 
-        public static EvaluationCheckDataResult  CheckData(EvaluationClient? evaluationLocal, EvaluationClient? evaluationCloud, List<string> msgs,LiteDBFactory _liteDBFactory )
+        public static EvaluationCheckDataResult  CheckData(EvaluationClient? evaluationLocal, EvaluationClient? evaluationCloud, List<string> successMsgs,List<string> errorMsgs, LiteDBFactory _liteDBFactory )
         {
             //数据,文件,页面 0 没有更新,1 有更新
             int data=0, blob=0, groupList=0, status=0,zip=0;
@@ -280,11 +306,11 @@ namespace IES.ExamServer.Services
             {
                 //线上线下没有数据
                 status=1;
-                msgs.Add($"本地和数据中心均没查询到评测!");
+                errorMsgs.Add($"本地和数据中心均没查询到评测!");
             }
             else if (evaluationLocal!=null && evaluationCloud!=null)
             {
-                msgs.Add($"检测到本地和数据中心均有数据!");
+                successMsgs.Add($"检测到本地和数据中心均有数据!");
                 //线上线下有数据
                 status = 2;
                 if ((!string.IsNullOrWhiteSpace(evaluationLocal.blobHash) &&  !evaluationLocal.blobHash.Equals(evaluationCloud.blobHash))
@@ -294,7 +320,7 @@ namespace IES.ExamServer.Services
                 {
                     blob=1;
                     blobSize=evaluationCloud.blobSize;
-                    msgs.Add($"文件包校验失败,需要更新文件包!");
+                    errorMsgs.Add($"文件包校验失败,需要更新文件包!");
                 }
                 if ((evaluationLocal.dataTime<evaluationCloud.dataTime)
                     ||(evaluationLocal.dataSize!=evaluationCloud.dataSize)
@@ -302,7 +328,7 @@ namespace IES.ExamServer.Services
                     )
                 {
                     data=1;
-                    msgs.Add($"数据包校验失败,需要更新数据包!");
+                    errorMsgs.Add($"数据包校验失败,需要更新数据包!");
                     dataSize=evaluationCloud.dataSize;
                 }
 
@@ -310,14 +336,14 @@ namespace IES.ExamServer.Services
                 {
                     groupList=1;
                     studentCount=evaluationCloud.studentCount;
-                    msgs.Add($"名单信息校验失败,需要更新名单信息!");
+                    errorMsgs.Add($"名单信息校验失败,需要更新名单信息!");
                 }
             }
             else if (evaluationLocal!=null && evaluationCloud==null)
             {
                 //线下有数据,线上没有数据,可能没联网。
                 status = 3;
-                msgs.Add($"数据中心未连接,使用本地数据进行作答!");
+                successMsgs.Add($"数据中心未连接,使用本地数据进行作答!");
             }
             else if (evaluationLocal==null && evaluationCloud!=null)
             {
@@ -331,9 +357,9 @@ namespace IES.ExamServer.Services
                 studentCount=evaluationCloud.studentCount;
                 status = 4;
                 _liteDBFactory.GetLiteDatabase().GetCollection<EvaluationClient>().Insert(evaluationLocal);
-                msgs.Add($"获取到最新的评测数据,需要下载数据包,文件包,名单信息!");
+                errorMsgs.Add($"获取到最新的评测数据,需要下载数据包,文件包,名单信息!");
             }
-            EvaluationCheckDataResult checkDataResult= new EvaluationCheckDataResult { data = data, blob = blob, groupList = groupList, status = status, dataSize = dataSize, blobSize = blobSize, studentCount = studentCount,zip=zip ,msgs=msgs};
+            EvaluationCheckDataResult checkDataResult= new EvaluationCheckDataResult { data = data, blob = blob, groupList = groupList, status = status, dataSize = dataSize, blobSize = blobSize, studentCount = studentCount,zip=zip ,successMsgs=successMsgs,errorMsgs=errorMsgs};
             return checkDataResult;
         }
        
@@ -347,7 +373,8 @@ namespace IES.ExamServer.Services
             public long dataSize { get; set; }
             public long blobSize { get; set; }
             public long studentCount { get; set; }
-            public List<string>? msgs { get; set; } = new List<string>();
+            public List<string> successMsgs { get; set; } = new List<string>();
+            public List<string> errorMsgs { get; set; } = new List<string>();
         }
         public class EvaluationCheckFileResult
         {
@@ -355,7 +382,8 @@ namespace IES.ExamServer.Services
             public int checkSuccess { get; set; }
 
             public int checkError { get; set; }
-            public List<string>? msgs { get; set; } = new List<string>();
+            public List<string> successMsgs { get; set; } = new List<string>();
+            public List<string> errorMsgs { get; set; } = new List<string>();
         }
     }
 }