yumeng 1 месяц назад
Родитель
Сommit
757e2fdf62
1 измененных файлов с 12 добавлено и 4 удалено
  1. 12 4
      src/main/java/com/adx/tencent/rta/BaiduRtaService.java

+ 12 - 4
src/main/java/com/adx/tencent/rta/BaiduRtaService.java

@@ -77,9 +77,13 @@ public class BaiduRtaService {
             return BaiduRtaDecision.bypass();
         }
         String tu = buildTu(tagId);
-        String requestOrderId = trimToNull(orderResolver == null ? null : orderResolver.resolveOrderId(tagId));
+        String linkOrderId = linkOrderId(params);
+        String requestOrderId = linkOrderId != null
+                ? linkOrderId
+                : trimToNull(orderResolver == null ? null : orderResolver.resolveOrderId(tagId));
+        String orderIdSource = linkOrderId != null ? "link" : "redis";
         if (requestOrderId == null) {
-            log.info("[RTA][{}][不请求RTA] reason=Redis未配置orderId matched=true allowBid=true action=直接参与竞价 tagId={} redisOnly=true",
+            log.info("[RTA][{}][不请求RTA] reason=链接和Redis均未配置orderId matched=true allowBid=true action=直接参与竞价 tagId={}",
                     mediaLabel(media), tagId);
             return BaiduRtaDecision.bypass();
         }
@@ -127,8 +131,8 @@ public class BaiduRtaService {
                 log.info("[RTA][{}][未命中][返回] requestId={} status={} headers={} body={}",
                         mediaLabel(media), requestId, response.statusCode(), response.headers().map(), responseBody);
             } else {
-                log.info("[RTA][{}][命中] requestId={} matched=true allowBid=true code={} requestOrderIds={} responseOrderIds={} latencyMs={} msg=命中,参与竞价",
-                        mediaLabel(media), requestId, code, requestOrderId, orderIds, latencyMs);
+                log.info("[RTA][{}][命中] requestId={} matched=true allowBid=true code={} orderIdSource={} requestOrderIds={} responseOrderIds={} latencyMs={} msg=命中,参与竞价",
+                        mediaLabel(media), requestId, code, orderIdSource, requestOrderId, orderIds, latencyMs);
             }
             return BaiduRtaDecision.of(matched, code, qk, requestId, tu, requestOrderId, orderIds, latencyMs, null);
         } catch (Exception e) {
@@ -263,6 +267,10 @@ public class BaiduRtaService {
         return idx >= 0 ? trimToNull(raw.substring(0, idx)) : trimToNull(raw);
     }
 
+    private static String linkOrderId(Map<String, String> params) {
+        return firstParam(params, "orderId", "order_id", "rtaOrderId", "rta_order_id");
+    }
+
     private static String firstParam(Map<String, String> params, String... keys) {
         if (params == null) return null;
         for (String key : keys) {