|
|
@@ -24,6 +24,7 @@ import com.adx.tencent.storage.model.BidRecord;
|
|
|
import com.adx.tencent.storage.model.ConversionRecord;
|
|
|
import com.adx.tencent.storage.model.MediaCallbackRecord;
|
|
|
import com.adx.tencent.storage.model.AccountTagEventRecord;
|
|
|
+import com.adx.tencent.storage.model.TencentTagEventProfileRecord;
|
|
|
import com.adx.tencent.tagsync.AccountTagEventResolver;
|
|
|
import com.adx.tencent.tagsync.TagEventResolver;
|
|
|
import com.adx.tencent.tencent.TencentClient;
|
|
|
@@ -448,6 +449,38 @@ public class ConversionSyncService {
|
|
|
}
|
|
|
|
|
|
private CallbackTask buildTencentCallbackTask(PaymentInfo payment, BidRecord bid) {
|
|
|
+ String callbackProfile = callbackProfile(bid.getMediaParams());
|
|
|
+ if (callbackProfile != null) {
|
|
|
+ if (coldStore == null) {
|
|
|
+ log.warn("[ConversionSync] 腾讯 profile 回传配置不可用, 跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ TencentTagEventProfileRecord profileMapping = coldStore.getTagEventProfile(
|
|
|
+ bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ if (profileMapping == null
|
|
|
+ || profileMapping.getTencentActionType() == null
|
|
|
+ || profileMapping.getTencentActionType().isBlank()) {
|
|
|
+ log.info("[ConversionSync] 腾讯 profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ String actionType = profileMapping.getTencentActionType();
|
|
|
+ String customAction = profileMapping.getTencentCustomAction();
|
|
|
+ if ("CUSTOM".equals(actionType) && (customAction == null || customAction.isBlank())) {
|
|
|
+ log.warn("[ConversionSync] 腾讯 profile CUSTOM 缺少 custom_action, 跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return CallbackTask.tencent(
|
|
|
+ payment,
|
|
|
+ bid,
|
|
|
+ callbackDedupeKey(payment, bid, actionType),
|
|
|
+ actionType,
|
|
|
+ customAction
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
String actionType = null;
|
|
|
String customAction = null;
|
|
|
if (accountTagEventResolver != null) {
|
|
|
@@ -497,9 +530,27 @@ public class ConversionSyncService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- Integer conversionId = honorTagEventResolver != null
|
|
|
- ? honorTagEventResolver.resolveConversionId(bid.getTagId(), payment.getAct())
|
|
|
- : resolveHonorConversionIdFromDb(bid.getTagId(), payment.getAct());
|
|
|
+ String callbackProfile = callbackProfile(bid.getMediaParams());
|
|
|
+ Integer conversionId;
|
|
|
+ if (callbackProfile != null) {
|
|
|
+ if (honorColdStore == null) {
|
|
|
+ log.warn("[ConversionSync] 荣耀 profile 回传配置不可用, 跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ com.adx.tencent.honor.model.HonorTagEventRecord profileEvent =
|
|
|
+ honorColdStore.getTagEventProfile(bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ if (profileEvent == null) {
|
|
|
+ log.info("[ConversionSync] 荣耀 profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ conversionId = profileEvent.getConversionId();
|
|
|
+ } else {
|
|
|
+ conversionId = honorTagEventResolver != null
|
|
|
+ ? honorTagEventResolver.resolveConversionId(bid.getTagId(), payment.getAct())
|
|
|
+ : resolveHonorConversionIdFromDb(bid.getTagId(), payment.getAct());
|
|
|
+ }
|
|
|
if (conversionId == null) {
|
|
|
conversionId = fallbackHonorConversionId(payment.getAct());
|
|
|
if (conversionId == null) {
|
|
|
@@ -537,7 +588,23 @@ public class ConversionSyncService {
|
|
|
return List.of();
|
|
|
}
|
|
|
|
|
|
- List<KuaishouTagEventRecord> tagEvents = resolveKuaishouTagEvents(bid.getTagId(), payment.getAct());
|
|
|
+ String callbackProfile = callbackProfile(bid.getMediaParams());
|
|
|
+ List<KuaishouTagEventRecord> tagEvents;
|
|
|
+ if (callbackProfile != null) {
|
|
|
+ if (kuaishouColdStore == null) {
|
|
|
+ log.warn("[ConversionSync] 快手 profile 回传配置不可用, 跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return List.of();
|
|
|
+ }
|
|
|
+ tagEvents = kuaishouColdStore.getTagEventProfiles(bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ if (tagEvents.isEmpty()) {
|
|
|
+ log.info("[ConversionSync] 快手 profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return List.of();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tagEvents = resolveKuaishouTagEvents(bid.getTagId(), payment.getAct());
|
|
|
+ }
|
|
|
if (tagEvents.isEmpty()) {
|
|
|
log.warn("[ConversionSync] 快手 eventType 未配置且无兜底映射 | qk={} | tagId={} | act={}",
|
|
|
payment.getQk(), bid.getTagId(), payment.getAct());
|
|
|
@@ -561,7 +628,23 @@ public class ConversionSyncService {
|
|
|
return List.of();
|
|
|
}
|
|
|
|
|
|
- List<VivoTagEventRecord> tagEvents = resolveVivoTagEvents(bid.getTagId(), payment.getAct());
|
|
|
+ String callbackProfile = callbackProfile(bid.getMediaParams());
|
|
|
+ List<VivoTagEventRecord> tagEvents;
|
|
|
+ if (callbackProfile != null) {
|
|
|
+ if (vivoColdStore == null) {
|
|
|
+ log.warn("[ConversionSync] vivo profile 回传配置不可用, 跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return List.of();
|
|
|
+ }
|
|
|
+ tagEvents = vivoColdStore.getTagEventProfiles(bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ if (tagEvents.isEmpty()) {
|
|
|
+ log.info("[ConversionSync] vivo profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return List.of();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ tagEvents = resolveVivoTagEvents(bid.getTagId(), payment.getAct());
|
|
|
+ }
|
|
|
if (tagEvents.isEmpty()) {
|
|
|
log.warn("[ConversionSync] vivo eventType 未配置且无兜底映射 | qk={} | tagId={} | act={}",
|
|
|
payment.getQk(), bid.getTagId(), payment.getAct());
|
|
|
@@ -581,8 +664,26 @@ public class ConversionSyncService {
|
|
|
}
|
|
|
|
|
|
private CallbackTask buildOppoCallbackTask(PaymentInfo payment, OppoBidRecord bid) {
|
|
|
- Integer dataType = oppoTagEventResolver == null ? null
|
|
|
- : oppoTagEventResolver.resolveDataType(bid.getTagId(), payment.getAct());
|
|
|
+ String callbackProfile = callbackProfile(bid.getMediaParams());
|
|
|
+ Integer dataType;
|
|
|
+ if (callbackProfile != null) {
|
|
|
+ if (oppoColdStore == null) {
|
|
|
+ log.warn("[ConversionSync] OPPO profile 回传配置不可用, 跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ OppoTagEventRecord profileEvent = oppoColdStore.getTagEventProfile(
|
|
|
+ bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ if (profileEvent == null) {
|
|
|
+ log.info("[ConversionSync] OPPO profile 未配置该 act, 严格跳过回传 | qk={} | tagId={} | profile={} | act={}",
|
|
|
+ payment.getQk(), bid.getTagId(), callbackProfile, payment.getAct());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ dataType = profileEvent.getDataType();
|
|
|
+ } else {
|
|
|
+ dataType = oppoTagEventResolver == null ? null
|
|
|
+ : oppoTagEventResolver.resolveDataType(bid.getTagId(), payment.getAct());
|
|
|
+ }
|
|
|
if (dataType == null) {
|
|
|
dataType = resolveOppoFallbackDataType(payment.getAct());
|
|
|
if (dataType != null) {
|
|
|
@@ -614,6 +715,10 @@ public class ConversionSyncService {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ private static String callbackProfile(Map<String, String> mediaParams) {
|
|
|
+ return firstParam(mediaParams, "callback_profile", "callbackProfile", "eventProfile", "mappingProfile");
|
|
|
+ }
|
|
|
+
|
|
|
private Integer resolveHonorConversionIdFromDb(String tagId, int baiduAct) {
|
|
|
if (honorColdStore == null) {
|
|
|
return null;
|