From b0d9ed1d6f078d3837de2cbec18cff83c3aeb9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Thu, 13 Nov 2025 16:33:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E4=BA=86=E6=97=A0=E6=B3=95=E8=AF=86=E5=88=AB=E7=9A=84=E5=B9=B4?= =?UTF-8?q?=E7=BA=A7=E5=AF=BC=E8=87=B4=E6=9F=A5=E8=AF=A2=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Learn.Archives.API/Controllers/ExamClassInfoController.cs | 6 +++++- Learn.Archives.API/Controllers/ExamController.cs | 4 ++++ Learn.Archives.API/Controllers/ExamUserInfoController.cs | 4 ++++ Learn.Archives.API/Controllers/StudentController.cs | 8 +++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Learn.Archives.API/Controllers/ExamClassInfoController.cs b/Learn.Archives.API/Controllers/ExamClassInfoController.cs index 50fbcca..7de18c1 100644 --- a/Learn.Archives.API/Controllers/ExamClassInfoController.cs +++ b/Learn.Archives.API/Controllers/ExamClassInfoController.cs @@ -113,7 +113,7 @@ namespace Learn.Archives.API.Controllers u.Id, }).ToDictionaryAsync(s => s.Name, s => s.Id); //处理学生成绩数据 - var userList = dataList.Select(s => + var userList = schoolArr.Select(s => { var classInfo = classArr .FirstOrDefault(x => x.Name == s.Class ); @@ -242,6 +242,10 @@ namespace Learn.Archives.API.Controllers CSharpTypeName="int" }); } + else + { + Oh.ModelError($"传入了无法识别的 年级 => {c.FieldValue}"); + } } return base.PageList(model); } diff --git a/Learn.Archives.API/Controllers/ExamController.cs b/Learn.Archives.API/Controllers/ExamController.cs index e28a7d7..b2b5caf 100644 --- a/Learn.Archives.API/Controllers/ExamController.cs +++ b/Learn.Archives.API/Controllers/ExamController.cs @@ -56,6 +56,10 @@ namespace Learn.Archives.API.Controllers CSharpTypeName = "int" }); } + else + { + Oh.ModelError($"传入了无法识别的 年级 => {c.FieldValue}"); + } } return base.PageList(model); diff --git a/Learn.Archives.API/Controllers/ExamUserInfoController.cs b/Learn.Archives.API/Controllers/ExamUserInfoController.cs index ca1d860..57bde89 100644 --- a/Learn.Archives.API/Controllers/ExamUserInfoController.cs +++ b/Learn.Archives.API/Controllers/ExamUserInfoController.cs @@ -47,6 +47,10 @@ namespace Learn.Archives.API.Controllers CSharpTypeName = "int" }); } + else + { + Oh.ModelError($"传入了无法识别的 年级 => {c.FieldValue}"); + } } var oldSer = model.OrderBy.ToEnum(); if (oldSer != null) diff --git a/Learn.Archives.API/Controllers/StudentController.cs b/Learn.Archives.API/Controllers/StudentController.cs index 51f762b..0823dd8 100644 --- a/Learn.Archives.API/Controllers/StudentController.cs +++ b/Learn.Archives.API/Controllers/StudentController.cs @@ -197,7 +197,7 @@ namespace Learn.Archives.API.Controllers //基础信息校验 if (string.IsNullOrEmpty(s.UserType) || string.IsNullOrEmpty(s.School)|| - string.IsNullOrEmpty(s.Class) || + (s.UserType != "年级主任" && string.IsNullOrEmpty(s.Class)) || string.IsNullOrEmpty(s.Phone)|| string.IsNullOrEmpty(s.RealName) ) @@ -275,6 +275,12 @@ namespace Learn.Archives.API.Controllers foreach (var s in dataList) { var ginfo = GradeHelper.GetStudentGradeBaseByGrade(s.Grade); + if(ginfo is null) + { + s.ErrorMsg = "未能识别的[初一/初2028] [年级范围应当是当前有效的就读年级]"; + impError.Add(s); + continue; + } var gStr = GradeHelper.GetGrade(ginfo.GradeLevel, ginfo.GradeYear); if (gStr.ToEnum() == null) //无效的传入年级 {