|
@@ -124,20 +124,46 @@ public class CourseQwController extends AppBaseController {
|
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
|
String json = configService.selectConfigByKey("course.config");
|
|
String json = configService.selectConfigByKey("course.config");
|
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
- FsUserCourseVideoH5DVO course = courseService.selectFsUserCourseVideoH5DVOByVideoId(param.getVideoId());
|
|
|
|
|
- List<FsUserCourseVideoQuestionVO> questionVOList = new ArrayList<>();
|
|
|
|
|
- if (StringUtils.isNotEmpty(course.getQuestionBankId())){
|
|
|
|
|
- String[] questionIds = course.getQuestionBankId().split(",");
|
|
|
|
|
- for (String questionId : questionIds){
|
|
|
|
|
- FsUserCourseVideoQuestionVO vo = new FsUserCourseVideoQuestionVO();
|
|
|
|
|
- FsCourseQuestionBank questionBank = questionBankService.selectFsCourseQuestionBankById(Long.parseLong(questionId));
|
|
|
|
|
- if (questionBank!=null&&questionBank.getStatus()!=0){
|
|
|
|
|
- BeanUtils.copyProperties(questionBank,vo);
|
|
|
|
|
- questionVOList.add(vo);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ FsUserCourseVideoH5DVO course = null;
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ course=redisCache.getCacheObject("cache:video1:"+param.getVideoId());
|
|
|
|
|
+ if(course==null){
|
|
|
|
|
+ course = courseService.selectFsUserCourseVideoH5DVOByVideoId(param.getVideoId());
|
|
|
|
|
+ redisCache.setCacheObject("cache:video1:"+param.getVideoId(),course, 10, TimeUnit.MINUTES);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception e){
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ if(course==null){
|
|
|
|
|
+ course = courseService.selectFsUserCourseVideoH5DVOByVideoId(param.getVideoId());
|
|
|
|
|
+ }
|
|
|
|
|
+ //获取题库
|
|
|
|
|
+ List<FsUserCourseVideoQuestionVO> questionVOList = null;
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+ questionVOList=redisCache.getCacheObject("cache:question:"+param.getVideoId());
|
|
|
|
|
+ if(questionVOList==null||questionVOList.size()==0){
|
|
|
|
|
+ questionVOList = new ArrayList<>();
|
|
|
|
|
+ if (StringUtils.isNotEmpty(course.getQuestionBankId())){
|
|
|
|
|
+ String[] questionIds = course.getQuestionBankId().split(",");
|
|
|
|
|
+ for (String questionId : questionIds){
|
|
|
|
|
+ FsUserCourseVideoQuestionVO vo = new FsUserCourseVideoQuestionVO();
|
|
|
|
|
+ FsCourseQuestionBank questionBank = questionBankService.selectFsCourseQuestionBankById(Long.parseLong(questionId));
|
|
|
|
|
+ if (questionBank!=null&&questionBank.getStatus()!=0){
|
|
|
|
|
+ BeanUtils.copyProperties(questionBank,vo);
|
|
|
|
|
+ questionVOList.add(vo);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ redisCache.setCacheObject("cache:question:"+param.getVideoId(),questionVOList, 10,TimeUnit.MINUTES);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ catch (Exception e){
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
|
Long duration = 0L;
|
|
Long duration = 0L;
|
|
|
long tipsTime = 0L;
|
|
long tipsTime = 0L;
|
|
@@ -306,7 +332,20 @@ public class CourseQwController extends AppBaseController {
|
|
|
}
|
|
}
|
|
|
return r;
|
|
return r;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ @Login
|
|
|
|
|
+ @ApiOperation("获取缓冲流量")
|
|
|
|
|
+ @GetMapping("/getInternetTraffic")
|
|
|
|
|
+ public R getInternetTrafficGet(@RequestBody FsUserCourseVideoFinishUParam param) {
|
|
|
|
|
+ R r = null;
|
|
|
|
|
+ Long userId = Long.parseLong(getUserId());
|
|
|
|
|
+ param.setUserId(userId);
|
|
|
|
|
+ if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
|
|
|
+ r = courseVideoService.getInternetTraffic(param);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ r = courseVideoService.getInternetTrafficIsOpen(param);
|
|
|
|
|
+ }
|
|
|
|
|
+ return r;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
// @Login
|
|
// @Login
|
|
|
// @ApiOperation("H5看课绑定手机号")
|
|
// @ApiOperation("H5看课绑定手机号")
|