From 44ed47e709f7f532a79eee587e31f15dab0fc761 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Wed, 24 Jul 2024 15:43:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E8=80=83=E8=AF=95=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_ExamRecordController.cs | 13 +++++++++- Tiobon.Core.Api/Tiobon.Core.xml | 7 +++++ .../Ghre/IGhre_ExamRecordServices.cs | 2 ++ .../Extend/Ghre_ExamRecordExtend.cs | 2 +- .../Ghre/Ghre_ExamRecordServices.cs | 26 +++++++++++++++++++ Tiobon.Core/Tiobon.Core.xml | 7 +++++ 6 files changed, 55 insertions(+), 2 deletions(-) diff --git a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs index 223e62fa..e63df571 100644 --- a/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs +++ b/Tiobon.Core.Api/Controllers/Ghre/Ghre_ExamRecordController.cs @@ -64,8 +64,19 @@ public class Ghre_ExamRecordController : BaseController学习记录ID/考试记录ID /// [HttpPost("QueryExam/{id}")] - public async Task> QueryExamAsync( long id) + public async Task> QueryExamAsync(long id) { return await _service.QueryExamAsync(id); } + + /// + /// 开始考试 + /// + /// + /// + [HttpPost("StartExam/{examRecordId}")] + public async Task StartExamAsync(long examRecordId) + { + return await _service.StartExamAsync(examRecordId); + } } \ No newline at end of file diff --git a/Tiobon.Core.Api/Tiobon.Core.xml b/Tiobon.Core.Api/Tiobon.Core.xml index 1586af2b..07ce3d8e 100644 --- a/Tiobon.Core.Api/Tiobon.Core.xml +++ b/Tiobon.Core.Api/Tiobon.Core.xml @@ -848,6 +848,13 @@ 学习记录ID/考试记录ID + + + 开始考试 + + + + Ghre_ExamRecordDetail(Controller) diff --git a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs index e8d9b411..5afb32e9 100644 --- a/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs +++ b/Tiobon.Core.IServices/Ghre/IGhre_ExamRecordServices.cs @@ -19,5 +19,7 @@ namespace Tiobon.Core.IServices Task CommentAsync(Ghre_ExamRecordExtend extend, long examRecordId); Task> QueryExamAsync(long id); + + Task StartExamAsync(long examRecordId); } } \ No newline at end of file diff --git a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs index b44ec07f..db92fd53 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/Ghre_ExamRecordExtend.cs @@ -44,7 +44,7 @@ public class QueryExam : DefaultGhre_ExamPaperPageData /// /// 剩余时间 /// - public string RemainingSecond { get; set; } + public int RemainingSecond { get; set; } /// /// 头像 diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index c0c3b503..55cbd1c2 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -554,6 +554,32 @@ public class Ghre_ExamRecordServices : BaseServices.OprateSuccess("查询成功!", extend); } + + + public async Task StartExamAsync(long examRecordId) + { + var entity = await base.QuerySingle(examRecordId); + + if (entity is null) + return ServiceResult.OprateFailed("无效的考试ID!"); + + if (entity.ActualBeginTime is null) + entity.ActualBeginTime = DateTime.Now; + if (entity.Status == "Wait") + entity.Status = "Examing"; + + await Update(entity, new List() + { + "ActualBeginTime", + "Status" + }); + + return ServiceResult.OprateSuccess("成功!"); + } } \ No newline at end of file diff --git a/Tiobon.Core/Tiobon.Core.xml b/Tiobon.Core/Tiobon.Core.xml index 1586af2b..07ce3d8e 100644 --- a/Tiobon.Core/Tiobon.Core.xml +++ b/Tiobon.Core/Tiobon.Core.xml @@ -848,6 +848,13 @@ 学习记录ID/考试记录ID + + + 开始考试 + + + + Ghre_ExamRecordDetail(Controller)