|
@@ -276,16 +276,20 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
|
|
|
//扣减库存
|
|
|
liveGoodsService.reduceGoodsStock(memberPayParamDto.getLiveGoodsId(),memberPayParamDto.getLiveId());
|
|
|
} else if (memberPayParamDto.getLiveGoodsId() == 2 || memberPayParamDto.getLiveGoodsId() == 3 || memberPayParamDto.getLiveGoodsId() == 4){
|
|
|
- StringBuffer sb = new StringBuffer(RedisKeyConstant.LIVE_GOODS_ZERO_CACHE_KEY).append(memberPayParamDto.getLiveGoodsId());
|
|
|
- RBucket<List<Integer>> bucket = redissonClient.getBucket(sb.toString());
|
|
|
- List<Integer> list = bucket.get();
|
|
|
- if(CollectionUtils.isEmpty(list)){
|
|
|
- list = new ArrayList<>();
|
|
|
- }
|
|
|
- //当前用户是否购买过免费直播课
|
|
|
- if(list.contains(sysUser.getId())){
|
|
|
+ TempBuyFreeLiveTheoryCourse temp = tempBuyFreeLiveTheoryCourseDao.findByGoodsIdAndUserId(memberPayParamDto.getLiveGoodsId(),student.getUserId());
|
|
|
+ if(Objects.nonNull(temp)){
|
|
|
throw new BizException("您已领取过本轮免费直播课");
|
|
|
}
|
|
|
+// StringBuffer sb = new StringBuffer(RedisKeyConstant.LIVE_GOODS_ZERO_CACHE_KEY).append(memberPayParamDto.getLiveGoodsId());
|
|
|
+// RBucket<List<Integer>> bucket = redissonClient.getBucket(sb.toString());
|
|
|
+// List<Integer> list = bucket.get();
|
|
|
+// if(CollectionUtils.isEmpty(list)){
|
|
|
+// list = new ArrayList<>();
|
|
|
+// }
|
|
|
+// //当前用户是否购买过免费直播课
|
|
|
+// if(list.contains(sysUser.getId())){
|
|
|
+// throw new BizException("您已领取过本轮免费直播课");
|
|
|
+// }
|
|
|
//购买次数是否超过2次
|
|
|
// int count = tempBuyFreeLiveTheoryCourseDao.countByUserId(sysUser.getId());
|
|
|
// if(count >= 2){
|
|
@@ -296,8 +300,8 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
|
|
|
new TempBuyFreeLiveTheoryCourse(sysUser.getId(),memberPayParamDto.getLiveId(),memberPayParamDto.getLiveGoodsId()));
|
|
|
//扣减库存
|
|
|
liveGoodsService.reduceGoodsStock(memberPayParamDto.getLiveGoodsId(),memberPayParamDto.getLiveId());
|
|
|
- list.add(sysUser.getId());
|
|
|
- bucket.set(list);
|
|
|
+// list.add(sysUser.getId());
|
|
|
+// bucket.set(list);
|
|
|
return BaseController.succeed();
|
|
|
}else {
|
|
|
throw new BizException("当前商品不可购买");
|
|
@@ -345,17 +349,21 @@ public class MemberRankSettingServiceImpl extends BaseServiceImpl<Integer, Membe
|
|
|
}
|
|
|
}
|
|
|
} else if (memberPayParamDto.getLiveGoodsId() == 2 || memberPayParamDto.getLiveGoodsId() == 3 || memberPayParamDto.getLiveGoodsId() == 4){
|
|
|
- StringBuffer sb = new StringBuffer(RedisKeyConstant.LIVE_GOODS_ZERO_CACHE_KEY).append(memberPayParamDto.getLiveGoodsId());
|
|
|
- RBucket<List<Integer>> bucket = redissonClient.getBucket(sb.toString());
|
|
|
- List<Integer> list = bucket.get();
|
|
|
- if(CollectionUtils.isEmpty(list)){
|
|
|
- list = new ArrayList<>();
|
|
|
- }
|
|
|
- //当前用户是否购买过免费直播课
|
|
|
- if(list.contains(sysUser.getId())){
|
|
|
- succeed.setMsg("您已领取过本轮免费直播课");
|
|
|
- return succeed;
|
|
|
+ TempBuyFreeLiveTheoryCourse temp = tempBuyFreeLiveTheoryCourseDao.findByGoodsIdAndUserId(memberPayParamDto.getLiveGoodsId(),sysUser.getId());
|
|
|
+ if(Objects.nonNull(temp)){
|
|
|
+ throw new BizException("您已领取过本轮免费直播课");
|
|
|
}
|
|
|
+// StringBuffer sb = new StringBuffer(RedisKeyConstant.LIVE_GOODS_ZERO_CACHE_KEY).append(memberPayParamDto.getLiveGoodsId());
|
|
|
+// RBucket<List<Integer>> bucket = redissonClient.getBucket(sb.toString());
|
|
|
+// List<Integer> list = bucket.get();
|
|
|
+// if(CollectionUtils.isEmpty(list)){
|
|
|
+// list = new ArrayList<>();
|
|
|
+// }
|
|
|
+// //当前用户是否购买过免费直播课
|
|
|
+// if(list.contains(sysUser.getId())){
|
|
|
+// succeed.setMsg("您已领取过本轮免费直播课");
|
|
|
+// return succeed;
|
|
|
+// }
|
|
|
//购买次数是否超过2次
|
|
|
// int count = tempBuyFreeLiveTheoryCourseDao.countByUserId(sysUser.getId());
|
|
|
// if(count >= 2){
|