|
|
@ -554,6 +554,32 @@ public class Ghre_ExamRecordServices : BaseServices<Ghre_ExamRecord, Ghre_ExamRe |
|
|
|
extend.ExamStatus = record.Status; |
|
|
|
extend.ExamStatus = record.Status; |
|
|
|
extend.TotalScore = record.TotalScore; |
|
|
|
extend.TotalScore = record.TotalScore; |
|
|
|
extend.Id = record.Id; |
|
|
|
extend.Id = record.Id; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TimeSpan timeDifference = record.EndTime.Value - DateTime.Now; |
|
|
|
|
|
|
|
extend.RemainingSecond = Convert.ToInt32(timeDifference.TotalSeconds); |
|
|
|
|
|
|
|
if (extend.RemainingSecond < 0) extend.RemainingSecond = 0; |
|
|
|
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend); |
|
|
|
return ServiceResult<QueryExam>.OprateSuccess("查询成功!", extend); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult> 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<string>() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
"ActualBeginTime", |
|
|
|
|
|
|
|
"Status" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ServiceResult.OprateSuccess("成功!"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |