/// <summary> /// 提交答案对象 同步跟读(单词,句子)、听力考试、模拟考试 /// </summary> /// <param name="answer"></param> /// <returns></returns> public bool SubmitWork(SpeekingAnswersEntity <WorkAnswerContract <ReadAnswerEntity> > answers) { if (answers == null) { return(false); } //分享答案数据包写入答案表 此处答案方式提交都是一致的 根据类型不同提取数据 //答案JSON编码 answers.AnswerData.ForEach(item => { item.AnswerContent = JSONHelper.Encode <List <ReadAnswerEntity> >(item.Answers); }); if (answers.Is_Work == 1) { var worksInfo = answers.worksInfo; //查询是否已做过 var unitWork = workService.GetUserUnitWork(answers.worksInfo.ContentId, answers.worksInfo.DoWorkId); worksInfo.Status = 3;//手动更新状态 worksInfo.SubmitCount = 1; worksInfo.WorkLong = Convert.ToInt32(worksInfo.WorkLong / 1000) + 1; worksInfo.WorkScore = worksInfo.ActualScore; if (unitWork != null) { worksInfo.WorkScore = 100; worksInfo.WorkLong = worksInfo.WorkLong + unitWork.WorkLong; //时长相加 worksInfo.DoId = unitWork.DoId; worksInfo.Comment = unitWork.Comment; worksInfo.CommentType = unitWork.CommentType; if (worksInfo.ActualScore < unitWork.ActualScore) {//如果成绩小于之前成绩 则沿用历史成绩 worksInfo.ActualScore = unitWork.ActualScore; } worksInfo.SubmitCount = unitWork.SubmitCount + 1; } return(workService.DoUnitWorks(worksInfo, answers.AnswerData) > 0); } else { var practiceInfo = answers.practiceInfo; practiceInfo.Status = 3;//手动更新状态 practiceInfo.WorkLong = Convert.ToInt32(practiceInfo.WorkLong / 1000) + 1; return(workService.DoIndepPractice(practiceInfo, answers.AnswerData) > 0); } }