diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs index 08928e96..d6d5e9f5 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_QuestionController.cs @@ -35,6 +35,11 @@ public class Ghre_QuestionController : BaseController + /// 根据Id查询数据 + /// + /// + /// [HttpPost("QueryFrom/{Id}")] public async Task> QueryFrom(long Id) { diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index ade0160c..7df2304f 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -826,6 +826,11 @@ 题目ID + + + 题目编号 + + 答案内容 @@ -841,6 +846,16 @@ 图片地址 + + + 图片宽度 + + + + + 图片宽度 + + 排序号 @@ -2184,6 +2199,11 @@ 题目ID + + + 题目编号 + + 答案内容 @@ -2199,6 +2219,16 @@ 图片地址 + + + 图片宽度 + + + + + 图片宽度 + + 排序号 diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 6ad696e6..7a555f86 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -553,6 +553,13 @@ 主键ID + + + 根据Id查询数据 + + + + 新增数据 diff --git a/Tiobon.Core.Model/Base/Ghre/Ghre_QuestionAnswer.Dto.Base.cs b/Tiobon.Core.Model/Base/Ghre/Ghre_QuestionAnswer.Dto.Base.cs index 75ba57c8..3e7c79e1 100644 --- a/Tiobon.Core.Model/Base/Ghre/Ghre_QuestionAnswer.Dto.Base.cs +++ b/Tiobon.Core.Model/Base/Ghre/Ghre_QuestionAnswer.Dto.Base.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2024/4/28 11:02:39 SimonHsiao 初版 +*V0.01 2024/5/8 10:36:27 SimonHsiao 初版 * * Copyright(c) 2024 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ @@ -31,6 +31,12 @@ namespace Tiobon.Core.Model.Models /// public long? QuestionId { get; set; } + /// + /// 题目编号 + /// + [Display(Name = "QuestionNo"), Description("题目编号"), MaxLength(32, ErrorMessage = "答案内容 不能超过 32 个字符")] + public string QuestionNo { get; set; } + /// /// 答案内容 /// @@ -48,6 +54,16 @@ namespace Tiobon.Core.Model.Models [Display(Name = "ImageUrl"), Description("图片地址"), MaxLength(64, ErrorMessage = "图片地址 不能超过 64 个字符")] public string ImageUrl { get; set; } + /// + /// 图片宽度 + /// + public int? ImageWidthPc { get; set; } + + /// + /// 图片宽度 + /// + public int? ImageWidthApp { get; set; } + /// /// 排序号 /// diff --git a/Tiobon.Core.Model/Models/Ghre/Ghre_QuestionAnswer.cs b/Tiobon.Core.Model/Models/Ghre/Ghre_QuestionAnswer.cs index 2df4483d..8394d2b6 100644 --- a/Tiobon.Core.Model/Models/Ghre/Ghre_QuestionAnswer.cs +++ b/Tiobon.Core.Model/Models/Ghre/Ghre_QuestionAnswer.cs @@ -6,7 +6,7 @@ * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── -*V0.01 2024/4/28 11:02:39 SimonHsiao 初版 +*V0.01 2024/5/8 10:36:27 SimonHsiao 初版 * * Copyright(c) 2024 Tiobon Corporation. All Rights Reserved. *┌──────────────────────────────────┐ @@ -33,6 +33,12 @@ namespace Tiobon.Core.Model.Models /// public long? QuestionId { get; set; } + /// + /// 题目编号 + /// + [Display(Name = "QuestionNo"), Description("题目编号"), MaxLength(32, ErrorMessage = "答案内容 不能超过 32 个字符")] + public string QuestionNo { get; set; } + /// /// 答案内容 /// @@ -50,6 +56,16 @@ namespace Tiobon.Core.Model.Models [Display(Name = "ImageUrl"), Description("图片地址"), MaxLength(64, ErrorMessage = "图片地址 不能超过 64 个字符")] public string ImageUrl { get; set; } + /// + /// 图片宽度 + /// + public int? ImageWidthPc { get; set; } + + /// + /// 图片宽度 + /// + public int? ImageWidthApp { get; set; } + /// /// 排序号 /// diff --git a/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs b/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs index 5413bd0a..b586212e 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/FromGhre_QuestionInput.cs @@ -40,6 +40,8 @@ public class FromGhre_QuestionQuestionTypeDetail public string difficulty { get; set; } public string content { get; set; } public string answer { get; set; } + public List answer1 { get; set; } + public string RemarkSz { get; set; } public List answerList { get; set; } = new List { }; } public class FromGhre_QuestionQuestionAnswerList @@ -47,6 +49,6 @@ public class FromGhre_QuestionQuestionAnswerList public string No { get; set; } public string label { get; set; } public string imageUrl { get; set; } - public int imgWidthPc { get; set; } - public int imgWidthApp { get; set; } + public int? imgWidthPc { get; set; } + public int? imgWidthApp { get; set; } } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs index a9777274..d3b2957d 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs @@ -15,10 +15,12 @@ namespace Tiobon.Core.Services public class Ghre_QuestionServices : BaseServices, IGhre_QuestionServices { private readonly IBaseRepository _dal; - public Ghre_QuestionServices(IBaseRepository dal) + private IGhre_QuestionAnswerServices _ghre_QuestionAnswerServices; + public Ghre_QuestionServices(IBaseRepository dal, IGhre_QuestionAnswerServices ghre_QuestionAnswerServices) { this._dal = dal; base.BaseDal = dal; + _ghre_QuestionAnswerServices = ghre_QuestionAnswerServices; } /// @@ -92,7 +94,28 @@ namespace Tiobon.Core.Services if (Id != 0) { - + var question = await base.QueryById(Id); + data.PageData.questionType.ForEach(x => x.isActive = 0); + var questionType = data.PageData.questionType.Where(x => x.type == question.QuestionType).FirstOrDefault(); + if (questionType != null) + { + var answers = await _ghre_QuestionAnswerServices.Query(x => x.QuestionId == Id, "TaxisNo ASC"); + questionType.isActive = 1; + questionType.detail.difficulty = question.DifficultyLevel; + questionType.detail.answer = answers.Where(x => x.IsCorrect == true).FirstOrDefault()?.QuestionNo; + questionType.detail.answer1 = answers.Where(x => x.IsCorrect == true).Select(x => x.QuestionNo).ToList(); + questionType.detail.answer1 = answers.Where(x => x.IsCorrect == true).Select(x => x.QuestionNo).ToList(); + questionType.detail.content = question.QuestionContent; + questionType.detail.RemarkSz = question.QuestionAnalysis; + questionType.detail.answerList = answers.Select(x => new FromGhre_QuestionQuestionAnswerList() + { + No = x.QuestionNo, + label = x.AnswerContent, + imageUrl = x.ImageUrl, + imgWidthPc = x.ImageWidthPc, + imgWidthApp = x.ImageWidthApp, + }).ToList(); + } } #endregion diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index ade0160c..7df2304f 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -826,6 +826,11 @@ 题目ID + + + 题目编号 + + 答案内容 @@ -841,6 +846,16 @@ 图片地址 + + + 图片宽度 + + + + + 图片宽度 + + 排序号 @@ -2184,6 +2199,11 @@ 题目ID + + + 题目编号 + + 答案内容 @@ -2199,6 +2219,16 @@ 图片地址 + + + 图片宽度 + + + + + 图片宽度 + + 排序号 diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 6ad696e6..7a555f86 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -553,6 +553,13 @@ 主键ID + + + 根据Id查询数据 + + + + 新增数据