|
@@ -121,52 +121,78 @@ public class CourseQwController extends AppBaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Long duration = 0L;
|
|
|
|
- long tipsTime = 0L;
|
|
|
|
- int isFinish = 0;
|
|
|
|
- if (param.getLinkType()!=null&¶m.getLinkType()==1){
|
|
|
|
- return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("tipsTime",tipsTime);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if (param.getIsRoom()!=null&¶m.getIsRoom()==1&¶m.getQwExternalId()==null){
|
|
|
|
- return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("tipsTime",tipsTime);
|
|
|
|
- }
|
|
|
|
- // 从Redis中获取观看时长
|
|
|
|
- String redisKey = "h5user:watch:duration:" + param.getQwUserId()+ ":" + param.getQwExternalId() + ":" + param.getVideoId();
|
|
|
|
- String durationStr = redisCache.getCacheObject(redisKey);
|
|
|
|
- FsCourseWatchLog log = courseWatchLogService.getWatchCourseVideo(param.getUserId(),param.getVideoId(),param.getQwUserId(),param.getQwExternalId());
|
|
|
|
- if (log==null){
|
|
|
|
- return R.error("记录不存在,请联系客服!");
|
|
|
|
- }
|
|
|
|
- //redis取不到查库
|
|
|
|
- if (durationStr != null) {
|
|
|
|
- duration = Long.parseLong(durationStr);
|
|
|
|
- }else {
|
|
|
|
- duration = log.getDuration();
|
|
|
|
- }
|
|
|
|
|
|
+ if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
|
|
+ Long duration = 0L;
|
|
|
|
+ long tipsTime = 0L;
|
|
|
|
+ int isFinish = 0;
|
|
|
|
+ if (param.getLinkType()!=null&¶m.getLinkType()==1){
|
|
|
|
+ return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("tipsTime",tipsTime);
|
|
|
|
+ }
|
|
|
|
|
|
- if (course.getDuration()!=null){
|
|
|
|
- tipsTime = course.getDuration()/2;
|
|
|
|
- }
|
|
|
|
- //判断是否完课
|
|
|
|
- if (log.getLogType()==2){
|
|
|
|
- isFinish=1;
|
|
|
|
- }
|
|
|
|
|
|
+ if (param.getIsRoom()!=null&¶m.getIsRoom()==1&¶m.getQwExternalId()==null){
|
|
|
|
+ return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("tipsTime",tipsTime);
|
|
|
|
+ }
|
|
|
|
+ // 从Redis中获取观看时长
|
|
|
|
+ String redisKey = "h5user:watch:duration:" + param.getQwUserId()+ ":" + param.getQwExternalId() + ":" + param.getVideoId();
|
|
|
|
+ String durationStr = redisCache.getCacheObject(redisKey);
|
|
|
|
+ FsCourseWatchLog log = courseWatchLogService.getWatchCourseVideo(param.getUserId(),param.getVideoId(),param.getQwUserId(),param.getQwExternalId());
|
|
|
|
+ if (log==null){
|
|
|
|
+ return R.error("记录不存在,请联系客服!");
|
|
|
|
+ }
|
|
|
|
+ //redis取不到查库
|
|
|
|
+ if (durationStr != null) {
|
|
|
|
+ duration = Long.parseLong(durationStr);
|
|
|
|
+ }else {
|
|
|
|
+ duration = log.getDuration();
|
|
|
|
+ }
|
|
|
|
|
|
- //将视频时长也存到redis
|
|
|
|
- String videoRedisKey = "h5user:video:duration:" + param.getVideoId();
|
|
|
|
- Long videoDuration = redisCache.getCacheObject(videoRedisKey);
|
|
|
|
- if (videoDuration==null){
|
|
|
|
|
|
+ if (course.getDuration()!=null){
|
|
|
|
+ tipsTime = course.getDuration()/2;
|
|
|
|
+ }
|
|
|
|
+ //判断是否完课
|
|
|
|
+ if (log.getLogType()==2){
|
|
|
|
+ isFinish=1;
|
|
|
|
+ }
|
|
|
|
|
|
- redisCache.setCacheObject(videoRedisKey,course.getDuration());
|
|
|
|
- }
|
|
|
|
- // 返回是否开启评论/弹幕。优先获取sop任务配置的是否开启评论/弹幕,如果没有配置就取总后台的配置;
|
|
|
|
- QwSop qwSop = qwSopService.selectQwSopById(log.getSopId());
|
|
|
|
- if(qwSop != null && qwSop.getOpenCommentStatus() != null) {
|
|
|
|
- config.setOpenCommentStatus(qwSop.getOpenCommentStatus());
|
|
|
|
|
|
+ //将视频时长也存到redis
|
|
|
|
+ String videoRedisKey = "h5user:video:duration:" + param.getVideoId();
|
|
|
|
+ Long videoDuration = redisCache.getCacheObject(videoRedisKey);
|
|
|
|
+ if (videoDuration==null){
|
|
|
|
+
|
|
|
|
+ redisCache.setCacheObject(videoRedisKey,course.getDuration());
|
|
|
|
+ }
|
|
|
|
+ // 返回是否开启评论/弹幕。优先获取sop任务配置的是否开启评论/弹幕,如果没有配置就取总后台的配置;
|
|
|
|
+ QwSop qwSop = qwSopService.selectQwSopById(log.getSopId());
|
|
|
|
+ if(qwSop != null && qwSop.getOpenCommentStatus() != null) {
|
|
|
|
+ config.setOpenCommentStatus(qwSop.getOpenCommentStatus());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("tipsTime",tipsTime).put("isFinish",isFinish);
|
|
|
|
+ }else{
|
|
|
|
+ Long duration = 0L;
|
|
|
|
+ int isFinish = 0;
|
|
|
|
+ // 从Redis中获取观看时长
|
|
|
|
+ String redisKey = "h5OpenUser:watch:duration:" + param.getUserId() + ":" + param.getVideoId();
|
|
|
|
+ String durationStr = redisCache.getCacheObject(redisKey);
|
|
|
|
+ FsCourseWatchLog log = courseWatchLogService.getWatchCourseVideoIsOpen(param.getUserId(),param.getVideoId());
|
|
|
|
+ if (log==null){
|
|
|
|
+ return R.error("记录不存在,请联系客服!");
|
|
|
|
+ }
|
|
|
|
+ //redis取不到查库
|
|
|
|
+ if (durationStr != null) {
|
|
|
|
+ duration = Long.parseLong(durationStr);
|
|
|
|
+ }else {
|
|
|
|
+ duration = log.getDuration();
|
|
|
|
+ }
|
|
|
|
+ //判断是否完课
|
|
|
|
+ if (log.getLogType()==2){
|
|
|
|
+ isFinish=1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("isFinish",isFinish);
|
|
}
|
|
}
|
|
|
|
|
|
- return R.ok().put("course",course).put("questions",questionVOList).put("config",config).put("playDuration",duration).put("tipsTime",tipsTime).put("isFinish",isFinish);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation("答题")
|
|
@ApiOperation("答题")
|
|
@@ -178,8 +204,14 @@ public class CourseQwController extends AppBaseController {
|
|
if (param.getDuration()==null){
|
|
if (param.getDuration()==null){
|
|
logger.info("zyp \n【未识别到时长】:{}",param.getUserId());
|
|
logger.info("zyp \n【未识别到时长】:{}",param.getUserId());
|
|
}
|
|
}
|
|
|
|
+ R r = null;
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
- return questionBankService.courseAnswer(param,false);
|
|
|
|
|
|
+ if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
|
|
+ r = questionBankService.courseAnswer(param,false);
|
|
|
|
+ }else{
|
|
|
|
+ r = questionBankService.courseAnswerIsOpen(param,false);
|
|
|
|
+ }
|
|
|
|
+ return r;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -206,8 +238,14 @@ public class CourseQwController extends AppBaseController {
|
|
@PostMapping("/updateWatchDuration")
|
|
@PostMapping("/updateWatchDuration")
|
|
public R updateWatchDuration(@RequestBody FsUserCourseVideoFinishUParam param)
|
|
public R updateWatchDuration(@RequestBody FsUserCourseVideoFinishUParam param)
|
|
{
|
|
{
|
|
|
|
+ R r = null;
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
param.setUserId(Long.parseLong(getUserId()));
|
|
- return courseVideoService.updateWatchDuration(param);
|
|
|
|
|
|
+ if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
|
|
+ r = courseVideoService.updateWatchDuration(param);
|
|
|
|
+ }else{
|
|
|
|
+ r = courseVideoService.updateWatchDurationIsOpen(param);
|
|
|
|
+ }
|
|
|
|
+ return r;
|
|
}
|
|
}
|
|
|
|
|
|
@Login
|
|
@Login
|
|
@@ -226,18 +264,31 @@ public class CourseQwController extends AppBaseController {
|
|
@ApiOperation("是否添加客服")
|
|
@ApiOperation("是否添加客服")
|
|
@PostMapping("/isAddKf")
|
|
@PostMapping("/isAddKf")
|
|
public R isAddKf(@RequestBody FsUserCourseVideoAddKfUParam param) {
|
|
public R isAddKf(@RequestBody FsUserCourseVideoAddKfUParam param) {
|
|
|
|
+
|
|
|
|
+ R r = null;
|
|
Long userId = Long.parseLong(getUserId());
|
|
Long userId = Long.parseLong(getUserId());
|
|
param.setUserId(userId);
|
|
param.setUserId(userId);
|
|
- return courseVideoService.isAddKf(param);
|
|
|
|
|
|
+ if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
|
|
+ r = courseVideoService.isAddKf(param);
|
|
|
|
+ }else{
|
|
|
|
+ r = courseVideoService.isAddKfIsOpen(param);
|
|
|
|
+ }
|
|
|
|
+ return r;
|
|
}
|
|
}
|
|
|
|
|
|
@Login
|
|
@Login
|
|
@ApiOperation("获取缓冲流量")
|
|
@ApiOperation("获取缓冲流量")
|
|
@PostMapping("/getInternetTraffic")
|
|
@PostMapping("/getInternetTraffic")
|
|
public R getInternetTraffic(@RequestBody FsUserCourseVideoFinishUParam param) {
|
|
public R getInternetTraffic(@RequestBody FsUserCourseVideoFinishUParam param) {
|
|
|
|
+ R r = null;
|
|
Long userId = Long.parseLong(getUserId());
|
|
Long userId = Long.parseLong(getUserId());
|
|
param.setUserId(userId);
|
|
param.setUserId(userId);
|
|
- return courseVideoService.getInternetTraffic(param);
|
|
|
|
|
|
+ if(param.getIsOpen() == null || param.getIsOpen() == 0){
|
|
|
|
+ r = courseVideoService.getInternetTraffic(param);
|
|
|
|
+ }else{
|
|
|
|
+ r = courseVideoService.getInternetTrafficIsOpen(param);
|
|
|
|
+ }
|
|
|
|
+ return r;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -288,7 +339,7 @@ public class CourseQwController extends AppBaseController {
|
|
|
|
|
|
@GetMapping("/test2")
|
|
@GetMapping("/test2")
|
|
public void test2() {
|
|
public void test2() {
|
|
-
|
|
|
|
|
|
+ courseWatchLogService.scheduleBatchUpdateToDatabaseIsOpen();
|
|
// courseVideoService.updateVideoUrl();
|
|
// courseVideoService.updateVideoUrl();
|
|
}
|
|
}
|
|
|
|
|