|
@@ -134,6 +134,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
@Autowired
|
|
|
private FsVideoResourceMapper fsVideoResourceMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private FsUserCourseMapper fsUserCourseMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 查询课堂视频
|
|
|
*
|
|
@@ -775,10 +778,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
|
|
|
|
|
|
// 更新观看记录的奖励类型
|
|
|
- if (param.getLinkType() == null || param.getLinkType() == 0) {
|
|
|
- log.setRewardType(config.getRewardType());
|
|
|
- courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
- }
|
|
|
+// if (param.getLinkType() == null || param.getLinkType() == 0) {
|
|
|
+ log.setRewardType(config.getRewardType());
|
|
|
+ courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
+// }
|
|
|
return sendRedPacket;
|
|
|
} else {
|
|
|
return R.error("奖励发送失败,请联系客服");
|
|
@@ -810,6 +813,10 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
integralLogs.setCreateTime(new Date());
|
|
|
fsUserIntegralLogsMapper.insertFsUserIntegralLogs(integralLogs);
|
|
|
|
|
|
+ //更新看课记录的奖励类型
|
|
|
+ log.setRewardType(config.getRewardType());
|
|
|
+ courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
+
|
|
|
return R.ok("奖励发放成功");
|
|
|
}
|
|
|
|
|
@@ -914,9 +921,18 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
log.setCompanyUserId(param.getCompanyUserId());
|
|
|
log.setVideoId(param.getVideoId());
|
|
|
List<FsCourseWatchLog> fsCourseWatchLogs = courseWatchLogMapper.selectFsCourseWatchLogList(log);
|
|
|
+
|
|
|
+ // 获取课程所属项目id
|
|
|
+ FsUserCourse fsUserCourse = fsUserCourseMapper.selectFsUserCourseByCourseId(param.getCourseId());
|
|
|
+ Long courseProject = null;
|
|
|
+ if(fsUserCourse != null){
|
|
|
+ courseProject = fsUserCourse.getProject();
|
|
|
+ }
|
|
|
//如果存在,则更新
|
|
|
if (fsCourseWatchLogs != null && !fsCourseWatchLogs.isEmpty()){
|
|
|
FsCourseWatchLog updateLog = new FsCourseWatchLog();
|
|
|
+ updateLog.setPeriodId(param.getPeriodId());
|
|
|
+ updateLog.setProject(courseProject);
|
|
|
updateLog.setUpdateTime(new Date());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(updateLog);
|
|
|
} else {
|
|
@@ -927,6 +943,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
fsCourseWatchLog.setDuration(0L);
|
|
|
fsCourseWatchLog.setCreateTime(new Date());
|
|
|
fsCourseWatchLog.setLogType(1);
|
|
|
+ fsCourseWatchLog.setProject(courseProject);
|
|
|
courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
|
|
|
}
|
|
|
} else {
|
|
@@ -958,7 +975,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
ResponseResult.ok(vo);
|
|
|
}
|
|
|
// 从Redis中获取用户目前的观看时长
|
|
|
- String redisKey = "h5wxuser:watch:duration:" + param.getFsUserId() + ":" + param.getVideoId();
|
|
|
+ String redisKey = "h5wxuser:watch:duration:" + param.getFsUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
|
|
|
String durationCurrent = redisCache.getCacheObject(redisKey);
|
|
|
|
|
|
//3、获取看课记录
|
|
@@ -1002,7 +1019,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
|
|
|
|
// 从Redis中获取观看时长
|
|
|
- String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId();
|
|
|
+ String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
|
|
|
try {
|
|
|
String durationStr = redisCache.getCacheObject(redisKey);
|
|
|
long duration = durationStr != null ? Long.parseLong(durationStr) : 0L;
|
|
@@ -1069,7 +1086,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
|
|
|
//会员-更新心跳时间
|
|
|
public void updateHeartbeatWx(FsUserCourseVideoUParam param) {
|
|
|
- String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId();
|
|
|
+ String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
|
|
|
redisCache.setCacheObject(redisKey, LocalDateTime.now().toString());
|
|
|
// 设置 Redis 记录的过期时间(例如 5 分钟)
|
|
|
redisCache.expire(redisKey, 300, TimeUnit.SECONDS);
|