This commit is contained in:
zhouwentao 2024-03-09 10:01:24 +08:00
parent 259ba3d777
commit bfe6bc25f9
2 changed files with 8 additions and 0 deletions

View File

@ -77,6 +77,13 @@ public class MiniVipController {
//检查card是否有效
boolean cardValid = yxVipCardService.cardIsValid(card);
AssertUtils.isTrue(cardValid,"当前卡密无效或已被使用");
YxVipCard yxVipCard = yxVipCardService.getOne(new LambdaQueryWrapper<YxVipCard>().eq(YxVipCard::getCardNum, card));
VipDTO userVip = miniUserService.getUserVip(user.getId());
if (userVip!=null) {
if (userVip.getSkuCode().equals(yxVipCard.getSkuCode())) {
throw new JeecgBootException("该类型激活码您已重复使用");
}
}
//使用卡密
boolean exchange = yxVipCardService.exchange(card, user.getId());
AssertUtils.isTrue(exchange,"当前卡密已被使用");

View File

@ -63,6 +63,7 @@ public class YxVipCardServiceImpl extends ServiceImpl<YxVipCardMapper, YxVipCard
}
LambdaQueryWrapper<YxVipCard> yxVipCardLambdaQueryWrapper = new LambdaQueryWrapper<>();
yxVipCardLambdaQueryWrapper.eq(YxVipCard::getUserId,userId);
yxVipCardLambdaQueryWrapper.orderByDesc(YxVipCard::getUsedTime);
return this.list(yxVipCardLambdaQueryWrapper);
}