|
|
@@ -8,6 +8,7 @@ import com.adx.tencent.tencent.TencentClient;
|
|
|
import com.adx.tencent.storage.RedisHotStore;
|
|
|
import com.adx.tencent.storage.TiDBColdStore;
|
|
|
import com.adx.tencent.storage.model.*;
|
|
|
+import com.adx.tencent.tagsync.TagEventResolver;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
|
@@ -30,14 +31,17 @@ public class ConversionSyncService {
|
|
|
private final RedisHotStore hotStore;
|
|
|
private final TencentClient tencentClient;
|
|
|
private final TiDBColdStore coldStore;
|
|
|
+ private final TagEventResolver tagEventResolver;
|
|
|
private final ExecutorService executor;
|
|
|
|
|
|
public ConversionSyncService(ConversionClient baiduClient, RedisHotStore hotStore,
|
|
|
- TencentClient tencentClient, TiDBColdStore coldStore) {
|
|
|
+ TencentClient tencentClient, TiDBColdStore coldStore,
|
|
|
+ TagEventResolver tagEventResolver) {
|
|
|
this.baiduClient = baiduClient;
|
|
|
this.hotStore = hotStore;
|
|
|
this.tencentClient = tencentClient;
|
|
|
this.coldStore = coldStore;
|
|
|
+ this.tagEventResolver = tagEventResolver;
|
|
|
this.executor = Executors.newFixedThreadPool(CONCURRENCY,
|
|
|
r -> { Thread t = new Thread(r, "conv-sync-worker"); t.setDaemon(true); return t; });
|
|
|
}
|
|
|
@@ -133,7 +137,16 @@ public class ConversionSyncService {
|
|
|
|
|
|
// 发送到腾讯
|
|
|
String platform = resolvePlatform(bid);
|
|
|
- MediaCallbackRecord callbackRecord = tencentClient.sendConversionEvent(bid, payment, platform);
|
|
|
+ // 根据广告位(tag_id)解析回传方式作为 action_type:Redis 优先,DB 兜底
|
|
|
+ String actionTypeOverride = null;
|
|
|
+ if (tagEventResolver != null) {
|
|
|
+ actionTypeOverride = tagEventResolver.resolveEventType(bid.getTagId());
|
|
|
+ }
|
|
|
+ if (actionTypeOverride == null || actionTypeOverride.isBlank()) {
|
|
|
+ log.warn("[ConversionSync] 广告位回传方式未配置, 回退act-map | qk={} | tagId={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), payment.getAct());
|
|
|
+ }
|
|
|
+ MediaCallbackRecord callbackRecord = tencentClient.sendConversionEvent(bid, payment, platform, actionTypeOverride);
|
|
|
callbackRecord.setDedupeKey(callbackKey);
|
|
|
|
|
|
if (callbackRecord.getStatus() == 0 && callbackRecord.getErrorMessage() != null) {
|