|
@@ -1132,7 +1132,7 @@ public class ConversionSyncService {
|
|
|
if (!task.isTencent() || task.tencentBid == null) {
|
|
if (!task.isTencent() || task.tencentBid == null) {
|
|
|
return DeductionHandling.SEND;
|
|
return DeductionHandling.SEND;
|
|
|
}
|
|
}
|
|
|
- int deductionRate = resolveDeductionRate(task.tencentBid);
|
|
|
|
|
|
|
+ int deductionRate = resolveDeductionRate(task.tencentBid, task.payment.getAct());
|
|
|
if (deductionRate <= 0) {
|
|
if (deductionRate <= 0) {
|
|
|
return DeductionHandling.SEND;
|
|
return DeductionHandling.SEND;
|
|
|
}
|
|
}
|
|
@@ -1191,9 +1191,9 @@ public class ConversionSyncService {
|
|
|
record.setAttempt(1);
|
|
record.setAttempt(1);
|
|
|
record.setErrorMessage("deducted_by_new_link_rate");
|
|
record.setErrorMessage("deducted_by_new_link_rate");
|
|
|
record.setDispatchStatus(MediaCallbackRecord.DISPATCH_STATUS_DEDUCTED);
|
|
record.setDispatchStatus(MediaCallbackRecord.DISPATCH_STATUS_DEDUCTED);
|
|
|
- record.setTrackingVersion(String.valueOf(resolveDeductionRate(task.tencentBid)));
|
|
|
|
|
|
|
+ record.setTrackingVersion(String.valueOf(resolveDeductionRate(task.tencentBid, task.payment.getAct())));
|
|
|
record.setCreatedAt(now);
|
|
record.setCreatedAt(now);
|
|
|
- int deductionRate = resolveDeductionRate(task.tencentBid);
|
|
|
|
|
|
|
+ int deductionRate = resolveDeductionRate(task.tencentBid, task.payment.getAct());
|
|
|
log.info("[ConversionSync] 腾讯转化扣量 | qk={} | act={} | rate={} | tagId={} | accountId={} | callbackKey={}",
|
|
log.info("[ConversionSync] 腾讯转化扣量 | qk={} | act={} | rate={} | tagId={} | accountId={} | callbackKey={}",
|
|
|
task.payment.getQk(), task.payment.getAct(), deductionRate,
|
|
task.payment.getQk(), task.payment.getAct(), deductionRate,
|
|
|
task.tencentBid.getTagId(), safe(task.tencentBid.getAccountId()), task.callbackKey);
|
|
task.tencentBid.getTagId(), safe(task.tencentBid.getAccountId()), task.callbackKey);
|
|
@@ -1313,20 +1313,50 @@ public class ConversionSyncService {
|
|
|
return (version == null || version.isBlank()) ? "v1" : version;
|
|
return (version == null || version.isBlank()) ? "v1" : version;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private int resolveDeductionRate(BidRecord bid) {
|
|
|
|
|
|
|
+ private int resolveDeductionRate(BidRecord bid, int act) {
|
|
|
if (bid == null || bid.getMediaParams() == null) {
|
|
if (bid == null || bid.getMediaParams() == null) {
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
- String rawRate = bid.getMediaParams().get(BidRecord.DEDUCTION_RATE_KEY);
|
|
|
|
|
- if (rawRate != null && !rawRate.isBlank()) {
|
|
|
|
|
- try {
|
|
|
|
|
- return sanitizeDeductionRate(Integer.parseInt(rawRate.trim()));
|
|
|
|
|
- } catch (NumberFormatException ignored) {
|
|
|
|
|
|
|
+ if (act == 2001) {
|
|
|
|
|
+ String rawActRate = firstParam(bid.getMediaParams(),
|
|
|
|
|
+ BidRecord.ACT_2001_DEDUCTION_RATE_KEY,
|
|
|
|
|
+ "act2001DeductionRate",
|
|
|
|
|
+ "deductionRate2001",
|
|
|
|
|
+ "deduction_rate_2001");
|
|
|
|
|
+ Integer actRate = parseDeductionRate(rawActRate);
|
|
|
|
|
+ if (actRate != null) {
|
|
|
|
|
+ return actRate;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ String rawRate = bid.getMediaParams().get(BidRecord.DEDUCTION_RATE_KEY);
|
|
|
|
|
+ Integer rate = parseDeductionRate(rawRate);
|
|
|
|
|
+ if (rate != null) {
|
|
|
|
|
+ return rate;
|
|
|
|
|
+ }
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static Integer parseDeductionRate(String rawRate) {
|
|
|
|
|
+ if (rawRate == null || rawRate.isBlank()) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ return sanitizeDeductionRate(Integer.parseInt(rawRate.trim()));
|
|
|
|
|
+ } catch (NumberFormatException ignored) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static String firstParam(Map<String, String> params, String... keys) {
|
|
|
|
|
+ for (String key : keys) {
|
|
|
|
|
+ String value = params.get(key);
|
|
|
|
|
+ if (value != null && !value.isBlank()) {
|
|
|
|
|
+ return value.trim();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private int resolveKuaishouDeductionRate(KuaishouBidRecord bid) {
|
|
private int resolveKuaishouDeductionRate(KuaishouBidRecord bid) {
|
|
|
if (bid == null || bid.getMediaParams() == null) {
|
|
if (bid == null || bid.getMediaParams() == null) {
|
|
|
return 0;
|
|
return 0;
|