|
@@ -5,6 +5,7 @@ import com.adx.tencent.baidu.model.NormalizedBidResponse;
|
|
|
import com.adx.tencent.baidu.model.TrackingResult;
|
|
import com.adx.tencent.baidu.model.TrackingResult;
|
|
|
import com.adx.tencent.vivo.model.VivoBidRecord;
|
|
import com.adx.tencent.vivo.model.VivoBidRecord;
|
|
|
import com.adx.tencent.vivo.model.VivoTrackingRecord;
|
|
import com.adx.tencent.vivo.model.VivoTrackingRecord;
|
|
|
|
|
+import com.adx.tencent.vivo.service.VivoAdvertiserSyncService;
|
|
|
import com.adx.tencent.vivo.service.VivoAuthService;
|
|
import com.adx.tencent.vivo.service.VivoAuthService;
|
|
|
import com.adx.tencent.vivo.service.VivoPlacement;
|
|
import com.adx.tencent.vivo.service.VivoPlacement;
|
|
|
import com.adx.tencent.vivo.store.VivoHotStore;
|
|
import com.adx.tencent.vivo.store.VivoHotStore;
|
|
@@ -44,17 +45,20 @@ public class VivoTrackingController {
|
|
|
private final VivoHotStore hotStore;
|
|
private final VivoHotStore hotStore;
|
|
|
private final VivoPlacement placement;
|
|
private final VivoPlacement placement;
|
|
|
private final VivoAuthService authService;
|
|
private final VivoAuthService authService;
|
|
|
|
|
+ private final VivoAdvertiserSyncService advertiserSyncService;
|
|
|
private final ObjectMapper objectMapper;
|
|
private final ObjectMapper objectMapper;
|
|
|
|
|
|
|
|
public VivoTrackingController(AdxClient adxClient,
|
|
public VivoTrackingController(AdxClient adxClient,
|
|
|
@Nullable VivoHotStore hotStore,
|
|
@Nullable VivoHotStore hotStore,
|
|
|
@Nullable VivoPlacement placement,
|
|
@Nullable VivoPlacement placement,
|
|
|
@Nullable VivoAuthService authService,
|
|
@Nullable VivoAuthService authService,
|
|
|
|
|
+ @Nullable VivoAdvertiserSyncService advertiserSyncService,
|
|
|
ObjectMapper objectMapper) {
|
|
ObjectMapper objectMapper) {
|
|
|
this.adxClient = adxClient;
|
|
this.adxClient = adxClient;
|
|
|
this.hotStore = hotStore;
|
|
this.hotStore = hotStore;
|
|
|
this.placement = placement;
|
|
this.placement = placement;
|
|
|
this.authService = authService;
|
|
this.authService = authService;
|
|
|
|
|
+ this.advertiserSyncService = advertiserSyncService;
|
|
|
this.objectMapper = objectMapper;
|
|
this.objectMapper = objectMapper;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -104,6 +108,14 @@ public class VivoTrackingController {
|
|
|
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "missing vivo code");
|
|
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "missing vivo code");
|
|
|
}
|
|
}
|
|
|
var token = authService.authorizeSecondaryAccount(secondaryAccountId, clientId, code);
|
|
var token = authService.authorizeSecondaryAccount(secondaryAccountId, clientId, code);
|
|
|
|
|
+ if (advertiserSyncService != null) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ advertiserSyncService.syncSecondaryAccount(token.getAccountId());
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("[Vivo][授权] secondaryAccountId={} immediate advertiser sync failed: {}",
|
|
|
|
|
+ token.getAccountId(), e.getMessage(), e);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return Map.of(
|
|
return Map.of(
|
|
|
"secondaryAccountId", token.getAccountId(),
|
|
"secondaryAccountId", token.getAccountId(),
|
|
|
"clientId", token.getClientId() == null ? "" : token.getClientId(),
|
|
"clientId", token.getClientId() == null ? "" : token.getClientId(),
|