Quellcode durchsuchen

fix 代充年付领取API50元额度

zoujiajian vor 1 Monat
Ursprung
Commit
cce53b4900

+ 9 - 2
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -253,6 +253,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	private static final Integer DEFAULT_API_QUOTA = 2500000;
 
+	private static final Integer YEAR_RECHARGE_API_QUOTA = 25000000;
+
 	@Override
 	public SearchResult<RenewalView> getMyTicket(long userId, Boolean isLoginPopularize, String customId, String account, String orderNo, Integer cmt) {
 		User u = userMapper.selectById(userId);
@@ -2859,10 +2861,11 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 			if (sourceOrder == null) {
 				throw BusinessRuntimeException.getInstance("不符合领取要求");
 			}
-            Long sourceGoodsId = sourceRelation.getGoodsId();
+			Long sourceGoodsId = sourceRelation.getGoodsId();
             if (!isGptApiQuotaSourceTicket(sourceOrder, sourceGoodsId, sourceSku.getNum())) {
                 throw BusinessRuntimeException.getInstance("当前车票不符合领取条件");
             }
+			Integer quota = isYearRechargeSku(sourceGoodsId, sourceSku.getMonths()) ? YEAR_RECHARGE_API_QUOTA : DEFAULT_API_QUOTA;
 
             Integer receivedCount = ticketRedemptionCodeRecordMapper.selectCount(Wrappers.lambdaQuery(TicketRedemptionCodeRecord.class)
                     .in(TicketRedemptionCodeRecord::getUserId, userIds)
@@ -2900,7 +2903,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 						throw BusinessRuntimeException.getInstance("系统繁忙,请重新领取");
 					}
 				}
-				GptActivityRedeemResult redeemResult = requestGptActivityRedeemCode(Constant.AI_API_SVC_DOMAIN, GPT_ACTIVITY_REDEEM_NAME, DEFAULT_API_QUOTA);
+				GptActivityRedeemResult redeemResult = requestGptActivityRedeemCode(Constant.AI_API_SVC_DOMAIN, GPT_ACTIVITY_REDEEM_NAME, quota);
 				record.setRelationId(giftRelation.getId());
 				record.setGoodsId(giftSku.getGoodsId());
                 record.setSourceGoodsId(sourceGoodsId);
@@ -3025,6 +3028,10 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
                 || (Constant.GPT_PLUS_GID.equals(goodsId) && Objects.equals(skuNum, 1))) && orderDon.getCreatedTime().after(DateUtil.parse("2026-05-01"));
     }
 
+    private boolean isYearRechargeSku(Long goodsId, Integer skuMonths) {
+        return Constant.GPT_RECHARGE_GOODS_ID.equals(goodsId) && skuMonths != null && skuMonths >= 12;
+    }
+
     private GroupsRelation getReusableGptActivityGiftRelation(List<Long> userIds, Long giftSkuId, Long sourceGoodsId) {
         TicketRedemptionCodeRecord retryRecord = ticketRedemptionCodeRecordMapper.selectOne(Wrappers.lambdaQuery(TicketRedemptionCodeRecord.class)
                 .in(TicketRedemptionCodeRecord::getUserId, userIds)