|
|
@@ -428,7 +428,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
ticket.setIsComplete(orderDon.getStatus() == OrderDon.Status.complete ? true : false);
|
|
|
}
|
|
|
}
|
|
|
- if (isGptApiQuotaSourceTicket(ticket.getGoodsId(), ticket.getSkuNum())) {
|
|
|
+ if (isGptApiQuotaSourceTicket(orderDon, ticket.getGoodsId(), ticket.getSkuNum())) {
|
|
|
markGptApiQuotaReceiveStatus(userIds, ticket);
|
|
|
}
|
|
|
if (lang != null && !StrUtil.equals(UserPageLanguage.Language.zh_CN.name(), lang)) {
|
|
|
@@ -2775,15 +2775,11 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
if (sourceSku == null) {
|
|
|
throw BusinessRuntimeException.getInstance("车票规格不存在");
|
|
|
}
|
|
|
- Long sourceGoodsId = sourceRelation.getGoodsId();
|
|
|
- if (!isGptApiQuotaSourceTicket(sourceGoodsId, sourceSku.getNum())) {
|
|
|
- throw BusinessRuntimeException.getInstance("当前车票不符合领取条件");
|
|
|
- }
|
|
|
-
|
|
|
OrderDon sourceOrder = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class)
|
|
|
.eq(OrderDon::getRelationId, sourceRelationId)
|
|
|
.in(OrderDon::getUserId, userIds)
|
|
|
- .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
+ .eq(OrderDon::getOrderType, 1)
|
|
|
+ .notIn(OrderDon::getStatus, Constant.noOrderAllStatus)
|
|
|
.and(wrapper -> wrapper.ge(OrderDon::getPayTime, GPT_ACTIVITY_PAY_TIME_BEGIN)
|
|
|
.or(sub -> sub.isNull(OrderDon::getPayTime).ge(OrderDon::getCreatedTime, GPT_ACTIVITY_PAY_TIME_BEGIN)))
|
|
|
.orderByDesc(OrderDon::getId)
|
|
|
@@ -2791,6 +2787,11 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
if (sourceOrder == null) {
|
|
|
throw BusinessRuntimeException.getInstance("不符合领取要求");
|
|
|
}
|
|
|
+ Long sourceGoodsId = sourceRelation.getGoodsId();
|
|
|
+ if (!isGptApiQuotaSourceTicket(sourceOrder, sourceGoodsId, sourceSku.getNum())) {
|
|
|
+ throw BusinessRuntimeException.getInstance("当前车票不符合领取条件");
|
|
|
+ }
|
|
|
+
|
|
|
Integer receivedCount = ticketRedemptionCodeRecordMapper.selectCount(Wrappers.lambdaQuery(TicketRedemptionCodeRecord.class)
|
|
|
.in(TicketRedemptionCodeRecord::getUserId, userIds)
|
|
|
.eq(TicketRedemptionCodeRecord::getSkuId, Constant.GPT_ACTIVITY_GIFT_SKU_ID)
|
|
|
@@ -2861,10 +2862,13 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private boolean isGptApiQuotaSourceTicket(Long goodsId, Integer skuNum) {
|
|
|
- return Constant.GPT_RECHARGE_GOODS_ID.equals(goodsId)
|
|
|
- || (Constant.GPT_PLUS_GID.equals(goodsId) && Objects.equals(skuNum, 1));
|
|
|
- }
|
|
|
+ private boolean isGptApiQuotaSourceTicket(OrderDon orderDon, Long goodsId, Integer skuNum) {
|
|
|
+ if (orderDon == null) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return (Constant.GPT_RECHARGE_GOODS_ID.equals(goodsId)
|
|
|
+ || (Constant.GPT_PLUS_GID.equals(goodsId) && Objects.equals(skuNum, 1)) && orderDon.getCreatedTime().after(DateUtil.parse("2026-05-03")));
|
|
|
+ }
|
|
|
|
|
|
private GroupsRelation getReusableGptActivityGiftRelation(List<Long> userIds, Long giftSkuId, Long sourceGoodsId) {
|
|
|
TicketRedemptionCodeRecord retryRecord = ticketRedemptionCodeRecordMapper.selectOne(Wrappers.lambdaQuery(TicketRedemptionCodeRecord.class)
|
|
|
@@ -2884,20 +2888,19 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
private GptActivityRedeemResult requestGptActivityRedeemCode(String apiDomain, GroupsRelation giftRelation, GoodsDonSku giftSku) throws Exception {
|
|
|
//默认5刀额度
|
|
|
Integer quota = 2500000;
|
|
|
- Long expiredTime = giftRelation.getExpiryTime() == null ? 0L : giftRelation.getExpiryTime().getTime() / 1000;
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("name", "GPT代充/独立赠送");
|
|
|
params.put("count", 1);
|
|
|
params.put("quota", quota);
|
|
|
- params.put("expired_time", expiredTime);
|
|
|
- params.put("share_user_id", 0);
|
|
|
String apiUrl = StrUtil.removeSuffix(apiDomain, "/") + "/api/redemption/";
|
|
|
- String response = HttpRequest.post(apiUrl)
|
|
|
- .header("Content-Type", "application/json")
|
|
|
- .body(Jsons.toJson(params))
|
|
|
- .timeout(15000)
|
|
|
- .execute()
|
|
|
- .body();
|
|
|
+ String response = HttpRequest.post(apiUrl)
|
|
|
+ .header("Content-Type", "application/json")
|
|
|
+ .header("Authorization", "Bearer " + Constant.NEBULA_API_AUTH_KEY)
|
|
|
+ .header("New-Api-User", Constant.NEBULA_NEW_API_USER)
|
|
|
+ .body(Jsons.toJson(params))
|
|
|
+ .timeout(15000)
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
if (StrUtil.isBlank(response)) {
|
|
|
throw BusinessRuntimeException.getInstance("系统异常,请重新兑换");
|
|
|
}
|
|
|
@@ -2914,7 +2917,6 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
|
|
|
result.setRedeemCode(dataNode.get(0).asText());
|
|
|
result.setApiResponse(response);
|
|
|
result.setQuota(quota);
|
|
|
- result.setExpiredTime(expiredTime);
|
|
|
return result;
|
|
|
}
|
|
|
|