This commit is contained in:
zhaolongfei
2024-05-29 11:29:49 +08:00
parent 309a6732bc
commit 8791256413

View File

@@ -555,7 +555,7 @@ public class StudyCourseApi extends ApiBaseController{
*/
@Deprecated
@RequestMapping(value="/appendtime",method = {RequestMethod.GET,RequestMethod.POST})
public JsonResponse<String> appendTime(StudyTime studyTime){
public JsonResponse<String> appendTime(StudyTime studyTime, HttpServletRequest request){
if(StringUtils.isBlank(studyTime.getStudyId())){
return error("参数错误");
@@ -569,11 +569,17 @@ public class StudyCourseApi extends ApiBaseController{
CurrentUser cuser=getCurrent();
studyTime.setStudentId(cuser.getAccountId());
studyTime.setStudentName(cuser.getName());
String token = request.getHeader("Xboe-Access-Token");
if (StringUtils.isEmpty(token)) {
token = request.getHeader("token");
}
try {
//此处需要优化处理,
//不能直接记录追加学习时间。以后增加到队列中,后台服务定时从队列中读取, 更新到系统中
//studyService.appendStudyDuration(studyTime);
studyService.appendStudyDuration(studyTime.getStudyId(),null,studyTime.getContentId(),studyTime.getDuration());
List<StudyCourse> allUserList = thirdApi.getStudyCourseList(studyTime.getStudyId() ,studyTime.getCourseId(), token);
log.info("在线课学习记录"+allUserList);
return success(studyTime.getId());
}catch(Exception e) {
log.error("记录学习时长错误",e);