|
@@ -104,7 +104,7 @@ public class HonorTrackingController {
|
|
|
return Map.of("qk", blocked.getQk(), "traceId", traceId, "tagId", tagId, "rtaCode", safeInt(blocked.getRtaCode()));
|
|
return Map.of("qk", blocked.getQk(), "traceId", traceId, "tagId", tagId, "rtaCode", safeInt(blocked.getRtaCode()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- NormalizedBidResponse response = adxClient.requestBid("honor", traceId, buildBidRequest(request, traceId, params));
|
|
|
|
|
|
|
+ NormalizedBidResponse response = adxClient.requestBid("honor", traceId, buildBidRequest(request, traceId, params, rtaDecision));
|
|
|
|
|
|
|
|
if (response == null) {
|
|
if (response == null) {
|
|
|
log.warn("[荣耀][曝光][百度结果] traceId={} empty=true", traceId);
|
|
log.warn("[荣耀][曝光][百度结果] traceId={} empty=true", traceId);
|
|
@@ -154,7 +154,7 @@ public class HonorTrackingController {
|
|
|
saveBlockedBid(blocked);
|
|
saveBlockedBid(blocked);
|
|
|
return responseBody(params, blocked.getQk(), traceId, tagId, rtaDecision);
|
|
return responseBody(params, blocked.getQk(), traceId, tagId, rtaDecision);
|
|
|
}
|
|
}
|
|
|
- NormalizedBidResponse bidResponse = adxClient.requestBid("honor", traceId, buildBidRequest(request, traceId, params));
|
|
|
|
|
|
|
+ NormalizedBidResponse bidResponse = adxClient.requestBid("honor", traceId, buildBidRequest(request, traceId, params, rtaDecision));
|
|
|
if (bidResponse == null) {
|
|
if (bidResponse == null) {
|
|
|
log.warn("[荣耀][点击][百度结果] traceId={} empty=true", traceId);
|
|
log.warn("[荣耀][点击][百度结果] traceId={} empty=true", traceId);
|
|
|
throw new ResponseStatusException(HttpStatus.BAD_GATEWAY, "empty baidu ADX response");
|
|
throw new ResponseStatusException(HttpStatus.BAD_GATEWAY, "empty baidu ADX response");
|
|
@@ -194,7 +194,10 @@ public class HonorTrackingController {
|
|
|
return responseBody(params, record.getQk(), traceId, tagId, rtaDecision);
|
|
return responseBody(params, record.getQk(), traceId, tagId, rtaDecision);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private Map<String, Object> buildBidRequest(HttpServletRequest request, String traceId, Map<String, String> params) {
|
|
|
|
|
|
|
+ private Map<String, Object> buildBidRequest(HttpServletRequest request,
|
|
|
|
|
+ String traceId,
|
|
|
|
|
+ Map<String, String> params,
|
|
|
|
|
+ BaiduRtaDecision rtaDecision) {
|
|
|
HonorPlacement.Resolved resolved = placement.resolve(params);
|
|
HonorPlacement.Resolved resolved = placement.resolve(params);
|
|
|
applyResolvedPlacement(params, resolved);
|
|
applyResolvedPlacement(params, resolved);
|
|
|
|
|
|
|
@@ -218,6 +221,7 @@ public class HonorTrackingController {
|
|
|
: placement.getActionTypes());
|
|
: placement.getActionTypes());
|
|
|
imp.put("maxCount", 1);
|
|
imp.put("maxCount", 1);
|
|
|
if (placement.getBidFloor() > 0) imp.put("bidFloor", placement.getBidFloor());
|
|
if (placement.getBidFloor() > 0) imp.put("bidFloor", placement.getBidFloor());
|
|
|
|
|
+ addRtaExtTransData(imp, rtaDecision);
|
|
|
|
|
|
|
|
Map<String, Object> device = new LinkedHashMap<>();
|
|
Map<String, Object> device = new LinkedHashMap<>();
|
|
|
putDeviceIp(device, firstParam(params, "ip", "m6a"), firstParam(params, "ipv6"), clientIp(request));
|
|
putDeviceIp(device, firstParam(params, "ip", "m6a"), firstParam(params, "ipv6"), clientIp(request));
|
|
@@ -264,6 +268,24 @@ public class HonorTrackingController {
|
|
|
return bidReq;
|
|
return bidReq;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private static void addRtaExtTransData(Map<String, Object> imp, BaiduRtaDecision decision) {
|
|
|
|
|
+ String orderId = rtaOrderId(decision);
|
|
|
|
|
+ if (orderId == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<String, Object> extTransData = new LinkedHashMap<>();
|
|
|
|
|
+ extTransData.put("key", "order_id");
|
|
|
|
|
+ extTransData.put("value", orderId);
|
|
|
|
|
+ imp.put("ext_trans_data", extTransData);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private static String rtaOrderId(BaiduRtaDecision decision) {
|
|
|
|
|
+ if (decision == null || !decision.isApplied() || !decision.isMatched()) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ return firstNonBlank(decision.getOrderIds(), decision.getRequestOrderIds());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private static void applyResolvedPlacement(Map<String, String> params, HonorPlacement.Resolved resolved) {
|
|
private static void applyResolvedPlacement(Map<String, String> params, HonorPlacement.Resolved resolved) {
|
|
|
params.put("baidu_app_id", resolved.appId());
|
|
params.put("baidu_app_id", resolved.appId());
|
|
|
params.put("baidu_tag_id", resolved.tagId());
|
|
params.put("baidu_tag_id", resolved.tagId());
|