|
|
@@ -1609,7 +1609,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
case 1:
|
|
|
if (param.getSource() == 3){
|
|
|
param.setWatchLogId(watchLog.getLogId());
|
|
|
- return withdrawal(param);
|
|
|
+ return withdrawal(param,1);
|
|
|
} else {
|
|
|
return sendRedPacketReward(param, user, watchLog, video, config);
|
|
|
}
|
|
|
@@ -4897,7 +4897,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public R withdrawal(FsCourseSendRewardUParam param) {
|
|
|
+ public R withdrawal(FsCourseSendRewardUParam param,Integer type) {
|
|
|
Long userId = param.getUserId();
|
|
|
// 生成锁的key,基于用户ID和视频ID确保同一用户同一视频的请求被锁定
|
|
|
String lockKey = "reward_red_lock:user:" + userId;
|
|
|
@@ -4912,7 +4912,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
|
|
|
logger.info("成功获取锁,开始处理奖励发放,用户ID:{}", userId);
|
|
|
- return executeWithdrawal(param);
|
|
|
+ return executeWithdrawal(param,type);
|
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
Thread.currentThread().interrupt();
|
|
|
@@ -5034,7 +5034,7 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
|
|
|
|
|
|
- private R executeWithdrawal(FsCourseSendRewardUParam param) {
|
|
|
+ private R executeWithdrawal(FsCourseSendRewardUParam param, Integer type) {
|
|
|
log.info("进入用户判断");
|
|
|
FsUser user = fsUserMapper.selectFsUserByUserId(param.getUserId());
|
|
|
if (user == null) {
|
|
|
@@ -5103,8 +5103,12 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
packetParam.setOpenId(openId);
|
|
|
BeanUtils.copyProperties(param, packetParam);
|
|
|
+ if (type==1){
|
|
|
+ return sendAppRedPacketAuto(packetParam, log,video, config);
|
|
|
+ }else if (type==2){
|
|
|
+ return sendAppRedPacket(packetParam, log,video, config);
|
|
|
+ }
|
|
|
|
|
|
- return sendAppRedPacket(packetParam, log,video, config);
|
|
|
// 积分奖励
|
|
|
case 2:
|
|
|
return sendIntegralReward(param, user, log, config);
|
|
|
@@ -5340,6 +5344,9 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * app手动看课的
|
|
|
+ */
|
|
|
private R sendAppRedPacket(WxSendRedPacketParam packetParam,FsCourseWatchLog log,FsUserCourseVideo video,CourseConfig config) {
|
|
|
FsUserCoursePeriodDays periodDays = new FsUserCoursePeriodDays();
|
|
|
periodDays.setVideoId(log.getVideoId());
|
|
|
@@ -5353,6 +5360,14 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
return R.error(403, "已超过领取红包时间");
|
|
|
}
|
|
|
|
|
|
+ // 手动的就多一个查询手动营期的时间 ,所以这里直接复用
|
|
|
+ return sendAppRedPacketAuto(packetParam,log,video,config);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * app自动看课的
|
|
|
+ */
|
|
|
+ private R sendAppRedPacketAuto(WxSendRedPacketParam packetParam,FsCourseWatchLog log,FsUserCourseVideo video,CourseConfig config) {
|
|
|
|
|
|
// 确定红包金额
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
|
@@ -5574,6 +5589,8 @@ public class FsUserCourseVideoServiceImpl extends ServiceImpl<FsUserCourseVideoM
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取用户openId
|
|
|
*/
|