From 67168bfd2f35770e962667ca8d2bd5791a26fd09 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 9 May 2024 20:02:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Services/CommonServices.cs | 2 +- Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs | 14 +++++--------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 9119c395..e37a3084 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -310,7 +310,7 @@ public partial class CommonServices : BaseServices>, ICommon AND a.UserID = '{1}' AND a.IsEnable = 1 AND a.PageSettingQueryId = b.PageSettingQueryId"; - sql = string.Format(sql, param.menuName, App.User.ID, param.langId); + sql = string.Format(sql, param.menuName, App.User.ID, param.langId); int UserHasSetting = Db.Ado.GetInt(sql); if (UserHasSetting == 0) { diff --git a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs index 640d14a3..40ebed8d 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs @@ -37,18 +37,14 @@ public class Ghre_QuestionServices : BaseServices>(); - var courseIds = data.Where(x => x.CourseId != null).Select(x => x.CourseId).ToList(); + var courseIds = data.Where(x => x.CourseId != null).Select(x => x.CourseId).Distinct().ToList(); var courses = await _ghre_CourseServices.Query(x => courseIds.Contains(x.Id)); - var classs = await _ghre_CourseClassServices.Query(); + var classsIds = courses.Select(x => x.CourseClassId).Distinct().ToList(); + var classs = await _ghre_CourseClassServices.Query(x => classsIds.Contains(x.Id)); data.ForEach(x => { - if (x.DifficultyLevel == "Easy") - x.DifficultyLevel = "简单"; - else if (x.DifficultyLevel == "Normal") - x.DifficultyLevel = "普通"; - else if (x.DifficultyLevel == "Hard") - x.DifficultyLevel = "困难"; + x.DifficultyLevel = ConvertDifficultyLevel(x.DifficultyLevel); x.QuestionType = ConvertQuestionType(x.QuestionType); if (x.CourseId != null) @@ -493,7 +489,7 @@ public class Ghre_QuestionServices : BaseServices