|
@@ -230,11 +230,11 @@ public class KuaishouTrackingController {
|
|
|
|
|
|
|
|
Map<String, Object> bidReq = new LinkedHashMap<>();
|
|
Map<String, Object> bidReq = new LinkedHashMap<>();
|
|
|
bidReq.put("mediaId", placement.getBaiduMediaId());
|
|
bidReq.put("mediaId", placement.getBaiduMediaId());
|
|
|
- bidReq.put("reqId", traceId + "-" + Instant.now().toEpochMilli());
|
|
|
|
|
|
|
+ bidReq.put("reqId", baiduReqId(traceId));
|
|
|
bidReq.put("imp", List.of(imp));
|
|
bidReq.put("imp", List.of(imp));
|
|
|
bidReq.put("device", device);
|
|
bidReq.put("device", device);
|
|
|
List<Integer> appList = parseAppList(firstParam(params, "appList", "app_list", "applist"));
|
|
List<Integer> appList = parseAppList(firstParam(params, "appList", "app_list", "applist"));
|
|
|
- if (!appList.isEmpty()) bidReq.put("appList", appList);
|
|
|
|
|
|
|
+ bidReq.put("appList", appList);
|
|
|
log.info("[快手][百度请求] traceId={} body={}", traceId, toJson(bidReq));
|
|
log.info("[快手][百度请求] traceId={} body={}", traceId, toJson(bidReq));
|
|
|
return bidReq;
|
|
return bidReq;
|
|
|
}
|
|
}
|
|
@@ -479,6 +479,17 @@ public class KuaishouTrackingController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private String baiduReqId(String traceId) {
|
|
|
|
|
+ String base = traceId == null ? "" : traceId.replaceAll("[^A-Za-z0-9_-]", "");
|
|
|
|
|
+ if (base.isBlank()) {
|
|
|
|
|
+ base = md5Hex(traceId == null ? "kuaishou" : traceId);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (base.length() > 64) {
|
|
|
|
|
+ base = base.substring(0, 64);
|
|
|
|
|
+ }
|
|
|
|
|
+ return base + "-" + Instant.now().toEpochMilli();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private String firstParam(Map<String, String> params, String... keys) {
|
|
private String firstParam(Map<String, String> params, String... keys) {
|
|
|
for (String key : keys) {
|
|
for (String key : keys) {
|
|
|
String value = params.get(key);
|
|
String value = params.get(key);
|