|
|
@@ -437,26 +437,27 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
|
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList).field(GroupsRelationView::getGoodsId, Constant.CLAUDE_CODE_GOODS_ID).field(GroupsRelationView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan).build());
|
|
|
if (groupsRelationView != null) {
|
|
|
- GoodsDonSku relationSku = goodsDonSkuMapper.selectById(groupsRelationView.getSkuId());
|
|
|
- //兑换的规格 低于当前规格 不让兑换
|
|
|
- if (relationSku.getClaudeDailyLimit() > sku.getClaudeDailyLimit()) {
|
|
|
- throw BusinessRuntimeException.getInstance("请在claude code当前版本过期后再兑换");
|
|
|
- }
|
|
|
- Date expiryTime = groupsRelationView.getExpiryTime();
|
|
|
- if (sku.getDays() != null) {
|
|
|
- expiryTime = DateUtil.offsetDay(expiryTime, sku.getDays());
|
|
|
- } else {
|
|
|
- expiryTime = DateUtil.offsetMonth(expiryTime, sku.getMonths());
|
|
|
- }
|
|
|
- GroupsRelation relation = groupsRelationMapper.selectById(groupsRelationView.getId());
|
|
|
- relation.setExpiryTime(expiryTime);
|
|
|
- groupsRelationMapper.updateById(relation);
|
|
|
- //同规格只加时长
|
|
|
- relation.setIsRenew(Boolean.TRUE);
|
|
|
- if (relationSku.getClaudeDailyLimit() != sku.getClaudeDailyLimit()) {
|
|
|
- relation.setIsClaudeCodeUpgrade(true);
|
|
|
- }
|
|
|
- return relation;
|
|
|
+// GoodsDonSku relationSku = goodsDonSkuMapper.selectById(groupsRelationView.getSkuId());
|
|
|
+// //兑换的规格 低于当前规格 不让兑换
|
|
|
+// if (relationSku.getClaudeDailyLimit() > sku.getClaudeDailyLimit()) {
|
|
|
+// throw BusinessRuntimeException.getInstance("请在claude code当前版本过期后再兑换");
|
|
|
+// }
|
|
|
+// Date expiryTime = groupsRelationView.getExpiryTime();
|
|
|
+// if (sku.getDays() != null) {
|
|
|
+// expiryTime = DateUtil.offsetDay(expiryTime, sku.getDays());
|
|
|
+// } else {
|
|
|
+// expiryTime = DateUtil.offsetMonth(expiryTime, sku.getMonths());
|
|
|
+// }
|
|
|
+// GroupsRelation relation = groupsRelationMapper.selectById(groupsRelationView.getId());
|
|
|
+// relation.setExpiryTime(expiryTime);
|
|
|
+// groupsRelationMapper.updateById(relation);
|
|
|
+// //同规格只加时长
|
|
|
+// relation.setIsRenew(Boolean.TRUE);
|
|
|
+// if (relationSku.getClaudeDailyLimit() != sku.getClaudeDailyLimit()) {
|
|
|
+// relation.setIsClaudeCodeUpgrade(true);
|
|
|
+// }
|
|
|
+// return relation;
|
|
|
+ throw BusinessRuntimeException.getInstance("您已有该车票,无法兑换");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -465,26 +466,27 @@ public class ExchangeCodeServiceImpl extends ServiceImpl<ExchangeCodeMapper, Exc
|
|
|
List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
GroupsRelationView groupsRelationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder().field(GroupsRelationView::getUserId, userIdList).op(Operator.InList).field(GroupsRelationView::getGoodsId, Constant.CODEX_GOODS_ID).field(GroupsRelationView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan).build());
|
|
|
if (groupsRelationView != null) {
|
|
|
- GoodsDonSku relationSku = goodsDonSkuMapper.selectById(groupsRelationView.getSkuId());
|
|
|
- //兑换的规格 低于当前规格 不让兑换
|
|
|
- if (relationSku.getOpenaiDailyLimit() > sku.getOpenaiDailyLimit()) {
|
|
|
- throw BusinessRuntimeException.getInstance("请在codex当前版本过期后再兑换");
|
|
|
- }
|
|
|
- Date expiryTime = groupsRelationView.getExpiryTime();
|
|
|
- if (sku.getDays() != null) {
|
|
|
- expiryTime = DateUtil.offsetDay(expiryTime, sku.getDays());
|
|
|
- } else {
|
|
|
- expiryTime = DateUtil.offsetMonth(expiryTime, sku.getMonths());
|
|
|
- }
|
|
|
- GroupsRelation relation = groupsRelationMapper.selectById(groupsRelationView.getId());
|
|
|
- relation.setExpiryTime(expiryTime);
|
|
|
- groupsRelationMapper.updateById(relation);
|
|
|
- //同规格只加时长
|
|
|
- relation.setIsRenew(Boolean.TRUE);
|
|
|
- if (relationSku.getOpenaiDailyLimit() != sku.getOpenaiDailyLimit()) {
|
|
|
- relation.setIsCodexUpgrade(true);
|
|
|
- }
|
|
|
- return relation;
|
|
|
+// GoodsDonSku relationSku = goodsDonSkuMapper.selectById(groupsRelationView.getSkuId());
|
|
|
+// //兑换的规格 低于当前规格 不让兑换
|
|
|
+// if (relationSku.getOpenaiDailyLimit() > sku.getOpenaiDailyLimit()) {
|
|
|
+// throw BusinessRuntimeException.getInstance("请在codex当前版本过期后再兑换");
|
|
|
+// }
|
|
|
+// Date expiryTime = groupsRelationView.getExpiryTime();
|
|
|
+// if (sku.getDays() != null) {
|
|
|
+// expiryTime = DateUtil.offsetDay(expiryTime, sku.getDays());
|
|
|
+// } else {
|
|
|
+// expiryTime = DateUtil.offsetMonth(expiryTime, sku.getMonths());
|
|
|
+// }
|
|
|
+// GroupsRelation relation = groupsRelationMapper.selectById(groupsRelationView.getId());
|
|
|
+// relation.setExpiryTime(expiryTime);
|
|
|
+// groupsRelationMapper.updateById(relation);
|
|
|
+// //同规格只加时长
|
|
|
+// relation.setIsRenew(Boolean.TRUE);
|
|
|
+// if (relationSku.getOpenaiDailyLimit() != sku.getOpenaiDailyLimit()) {
|
|
|
+// relation.setIsCodexUpgrade(true);
|
|
|
+// }
|
|
|
+// return relation;
|
|
|
+ throw BusinessRuntimeException.getInstance("您已有该车票,无法兑换");
|
|
|
}
|
|
|
}
|
|
|
Integer retryNum = 1;
|