修复 更新学生学科 导致的学科枚举转换异常问题 #52

Merged
hy merged 1 commits from dev into staging 2025-12-08 09:41:54 +08:00
1 changed files with 9 additions and 5 deletions

View File

@ -424,14 +424,18 @@ namespace Learn.Archives.API.Controllers
var subjectArr = row..Split("")
.Select(s => s.ToEnum<SubjectEnum>())
.ToArray();
userCenterUpdate.Add(new User
var upUser = new User
{
Id = uid,
Phone = row.Phone,
GLSubject = (int?)subjectArr[0],
GSubject1 = (int?)subjectArr[1],
GSubject2 = (int?)subjectArr[2],
});
};
if (subjectArr.Length > 0)
upUser.GLSubject = (int?)subjectArr[0];
if (subjectArr.Length > 1)
upUser.GSubject1 = (int?)subjectArr[1];
if (subjectArr.Length > 2)
upUser.GSubject2 = (int?)subjectArr[2];
userCenterUpdate.Add(upUser);
}
}