|
@@ -104,6 +104,9 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
private FsCourseLinkMapper courseLinkMapper;
|
|
|
@Autowired
|
|
|
RedisCache redisCache;
|
|
|
+ @Autowired
|
|
|
+ private ISysConfigService sysConfigService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询课堂视频
|
|
|
*
|
|
@@ -581,8 +584,13 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
|
|
|
|
FsUserCourseVideo video = fsUserCourseVideoMapper.selectFsUserCourseVideoByVideoId(param.getVideoId());
|
|
|
+
|
|
|
+ // 获取配置
|
|
|
+ String json = configService.selectConfigByKey("course.config");
|
|
|
+ CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
+
|
|
|
//发放奖励
|
|
|
- switch (param.getRewardType()){
|
|
|
+ switch (config.getRewardType()){
|
|
|
//红包奖励
|
|
|
case 1:
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
@@ -613,7 +621,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
redPacketLog.setWatchLogId(log.getLogId() !=null ? log.getLogId() : null);
|
|
|
redPacketLogMapper.insertFsCourseRedPacketLog(redPacketLog);
|
|
|
if (param.getLinkType()==null || param.getLinkType()==0){
|
|
|
- log.setRewardType(param.getRewardType());
|
|
|
+ log.setRewardType(config.getRewardType());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
}
|
|
|
return R.ok("奖励发放成功");
|
|
@@ -622,8 +630,6 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
}
|
|
|
//积分奖励
|
|
|
case 2:
|
|
|
- String json = configService.selectConfigByKey("course.config");
|
|
|
- CourseConfig config = JSONUtil.toBean(json, CourseConfig.class);
|
|
|
//增加积分
|
|
|
FsUser userMap=new FsUser();
|
|
|
userMap.setUserId(user.getUserId());
|
|
@@ -638,7 +644,7 @@ public class FsUserCourseVideoServiceImpl implements IFsUserCourseVideoService
|
|
|
integralLogs.setCreateTime(new Date());
|
|
|
fsUserIntegralLogsMapper.insertFsUserIntegralLogs(integralLogs);
|
|
|
if (param.getLinkType()==null || param.getLinkType()==0 ){
|
|
|
- log.setRewardType(param.getRewardType());
|
|
|
+ log.setRewardType(config.getRewardType());
|
|
|
courseWatchLogMapper.updateFsCourseWatchLog(log);
|
|
|
//转换红包
|
|
|
FsCourseRedPacketLog redPacketLog = new FsCourseRedPacketLog();
|