|
@@ -428,7 +428,21 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
if (fsUser.getStatus()==0){
|
|
|
return R.error("会员被停用,无权限,请联系客服!");
|
|
|
}
|
|
|
-
|
|
|
+// if (param.getIsOpenCourse()!=null&¶m.getIsOpenCourse()==1){
|
|
|
+// FsCourseWatchLog log = courseWatchLogMapper.getWatchCourseVideoByUserId(param.getUserId(), param.getVideoId());
|
|
|
+// if (log==null){
|
|
|
+// FsCourseWatchLog userLog = new FsCourseWatchLog();
|
|
|
+// BeanUtils.copyProperties(param,log);
|
|
|
+// userLog.setSendType(0);
|
|
|
+// userLog.setUserId(param.getUserId());
|
|
|
+// userLog.setVideoId(param.getVideoId());
|
|
|
+// userLog.setDuration(0L);
|
|
|
+// userLog.setCreateTime(new Date());
|
|
|
+// userLog.setLogType(3);
|
|
|
+// courseWatchLogMapper.insertFsCourseWatchLog(log);
|
|
|
+// }
|
|
|
+// return R.ok();
|
|
|
+// }
|
|
|
String msg = "<div style=\"color: red;margin-bottom: 15px;font-weight: bold;\">本课程为会员独享<br>请长按二维码</div>\n" +
|
|
|
"\t\t\t\t\t<div style=\"color: #999;font-size: 14px;font-weight: bold;\">添加伴学助手免费领取会员权限</div>";
|
|
|
// try {
|
|
@@ -1425,7 +1439,29 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
if (fsUser == null){
|
|
|
return ResponseResult.fail(404,"当前用户信息不存在");
|
|
|
}
|
|
|
-
|
|
|
+ //公开课
|
|
|
+ if (param.getIsOpenCourse()!=null && param.getIsOpenCourse()==1){
|
|
|
+ FsCourseWatchLog watchCourseVideo = courseWatchLogMapper.getCourseWatchLogByUser(param.getUserId(), param.getVideoId());
|
|
|
+ //添加判断:该用户是否已经存在此课程的看课记录,并且看课记录的销售id不是传入的销售id
|
|
|
+ if(watchCourseVideo != null){
|
|
|
+ FsCourseWatchLog updateLog = new FsCourseWatchLog();
|
|
|
+ updateLog.setUpdateTime(new Date());
|
|
|
+ courseWatchLogMapper.updateFsCourseWatchLog(updateLog);
|
|
|
+ } else {
|
|
|
+ FsCourseWatchLog fsCourseWatchLog = new FsCourseWatchLog();
|
|
|
+ BeanUtils.copyProperties(param, fsCourseWatchLog);
|
|
|
+ fsCourseWatchLog.setSendType(1);
|
|
|
+ fsCourseWatchLog.setDuration(0L);
|
|
|
+ fsCourseWatchLog.setCreateTime(new Date());
|
|
|
+ fsCourseWatchLog.setLogType(1);
|
|
|
+ courseWatchLogMapper.insertFsCourseWatchLog(fsCourseWatchLog);
|
|
|
+ String redisKey = "h5wxuser:watch:heartbeat:" + param.getUserId() + ":" + param.getVideoId() + ":" + 0;
|
|
|
+ redisCache.setCacheObject(redisKey, LocalDateTime.now().toString());
|
|
|
+ // 设置 Redis 记录的过期时间(例如 5 分钟)
|
|
|
+ redisCache.expire(redisKey, 300, TimeUnit.SECONDS);
|
|
|
+ }
|
|
|
+ return ResponseResult.ok(Boolean.TRUE);
|
|
|
+ }
|
|
|
//判断该销售是否存在
|
|
|
CompanyUser companyUser = companyUserMapper.selectCompanyUserById(param.getCompanyUserId());
|
|
|
if (companyUser == null){
|
|
@@ -1748,7 +1784,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
if (param.getLinkType() != null && param.getLinkType() == 1){
|
|
|
return R.ok();
|
|
|
}
|
|
|
-
|
|
|
+ if (param.getCompanyUserId()==null){
|
|
|
+ param.setCompanyUserId(0L);
|
|
|
+ }
|
|
|
// 从Redis中获取观看时长
|
|
|
String redisKey = "h5wxuser:watch:duration:" + param.getUserId() + ":" + param.getVideoId() + ":" + param.getCompanyUserId();
|
|
|
log.info("看课redis缓存key:{}", redisKey);
|