|
@@ -24,7 +24,6 @@ import java.nio.charset.StandardCharsets;
|
|
|
import java.time.Instant;
|
|
import java.time.Instant;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.concurrent.Semaphore;
|
|
import java.util.concurrent.Semaphore;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 腾讯监测链接接收端点。
|
|
* 腾讯监测链接接收端点。
|
|
@@ -148,7 +147,7 @@ public class TrackingController {
|
|
|
log.info("[腾讯][曝光][入参] traceId={} ip={} params={}", traceId, clientIp(request), params);
|
|
log.info("[腾讯][曝光][入参] traceId={} ip={} params={}", traceId, clientIp(request), params);
|
|
|
|
|
|
|
|
Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
|
|
Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
|
|
|
- NormalizedBidResponse response = requestTencentBidWithTiming("曝光", traceId, bidRequest);
|
|
|
|
|
|
|
+ NormalizedBidResponse response = adxClient.requestBid("tencent", traceId, bidRequest);
|
|
|
if (response == null) {
|
|
if (response == 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");
|
|
@@ -274,7 +273,7 @@ public class TrackingController {
|
|
|
if (record == null) {
|
|
if (record == null) {
|
|
|
// 未找到,临时发起竞价请求
|
|
// 未找到,临时发起竞价请求
|
|
|
Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
|
|
Map<String, Object> bidRequest = mediaBidRequest(request, "tencent", traceId, params, tencentPlacement);
|
|
|
- NormalizedBidResponse resp = requestTencentBidWithTiming("点击", traceId, bidRequest);
|
|
|
|
|
|
|
+ NormalizedBidResponse resp = adxClient.requestBid("tencent", traceId, bidRequest);
|
|
|
if (resp == null) {
|
|
if (resp == 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");
|
|
@@ -317,22 +316,6 @@ public class TrackingController {
|
|
|
return Map.of("qk", nvl(record.getQk()), "traceId", traceId);
|
|
return Map.of("qk", nvl(record.getQk()), "traceId", traceId);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private NormalizedBidResponse requestTencentBidWithTiming(String phase,
|
|
|
|
|
- String traceId,
|
|
|
|
|
- Map<String, Object> bidRequest) throws Exception {
|
|
|
|
|
- long startNanos = System.nanoTime();
|
|
|
|
|
- boolean success = false;
|
|
|
|
|
- try {
|
|
|
|
|
- NormalizedBidResponse response = adxClient.requestBid("tencent", traceId, bidRequest);
|
|
|
|
|
- success = response != null;
|
|
|
|
|
- return response;
|
|
|
|
|
- } finally {
|
|
|
|
|
- long costMs = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startNanos);
|
|
|
|
|
- log.info("[腾讯][{}][百度竞价耗时] traceId={} costMs={} success={}",
|
|
|
|
|
- phase, traceId, costMs, success);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
private void markTrackingVersion(Map<String, String> params, String trackingVersion, int deductionRate) {
|
|
private void markTrackingVersion(Map<String, String> params, String trackingVersion, int deductionRate) {
|
|
|
boolean isNewLink = !"v1".equalsIgnoreCase(trackingVersion);
|
|
boolean isNewLink = !"v1".equalsIgnoreCase(trackingVersion);
|
|
|
params.put(BidRecord.NEW_LINK_FLAG_KEY, Boolean.toString(isNewLink));
|
|
params.put(BidRecord.NEW_LINK_FLAG_KEY, Boolean.toString(isNewLink));
|