|
@@ -80,7 +80,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
IAiBytedanceAutocreateLogService iBytedanceAutocreateLogService;
|
|
IAiBytedanceAutocreateLogService iBytedanceAutocreateLogService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public Long createCreative(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl) throws ParseException {
|
|
|
|
|
|
+ public synchronized Long createCreative(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl) throws ParseException {
|
|
UserAllocation userAllocation = userAllocationService.getByAccountId(strategy.getAccountId());
|
|
UserAllocation userAllocation = userAllocationService.getByAccountId(strategy.getAccountId());
|
|
if(null == userAllocation||userAllocation.getAccountStatus()!=0){
|
|
if(null == userAllocation||userAllocation.getAccountStatus()!=0){
|
|
log.info("此账户不存在或者已经被关闭=>accountId:{}", token.getAccountId());
|
|
log.info("此账户不存在或者已经被关闭=>accountId:{}", token.getAccountId());
|
|
@@ -158,9 +158,9 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
|
|
|
//3:创建创意
|
|
//3:创建创意
|
|
JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
|
|
JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
|
|
- log.info("账户id:{};创意创建参数:{}",strategy.getAccountId(),creativeParams);
|
|
|
|
|
|
+ log.info("账户id:{},不使用dp链接;创意创建参数:{}",strategy.getAccountId(),creativeParams);
|
|
JSONObject creativeObject = marketingService.creativeCreate(token,adId,creativeParams);
|
|
JSONObject creativeObject = marketingService.creativeCreate(token,adId,creativeParams);
|
|
- log.info("创建创意=====》》》》》》{}",creativeObject);
|
|
|
|
|
|
+ log.info("账户id:{},不使用dp链接;创建返回数据=====》》》》》》{}",token.getAccountId(),creativeObject);
|
|
if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
|
|
if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
|
|
List<Long> adIds = new ArrayList<>();
|
|
List<Long> adIds = new ArrayList<>();
|
|
adIds.add(adId);
|
|
adIds.add(adId);
|
|
@@ -174,7 +174,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
"创意创建失败",
|
|
"创意创建失败",
|
|
code,
|
|
code,
|
|
message,
|
|
message,
|
|
- "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+",creativeParams:"+creativeParams.toJSONString());
|
|
|
|
|
|
+ "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+"strategy:"+strategy.getAccountId()+",creativeParams:"+creativeParams.toJSONString());
|
|
iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
|
|
iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -238,9 +238,11 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
}
|
|
}
|
|
//3:创建创意
|
|
//3:创建创意
|
|
JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
|
|
JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
|
|
- log.info("创意创建参数:{}",creativeParams);
|
|
|
|
|
|
+ log.info("账户id:{},使用dp链接;创意创建参数:{}",strategy.getAccountId(),creativeParams);
|
|
|
|
+
|
|
JSONObject creativeObject = marketingService.creativeCreate(token,adId,creativeParams);
|
|
JSONObject creativeObject = marketingService.creativeCreate(token,adId,creativeParams);
|
|
- log.info("创意创建返回数据:{}",creativeObject);
|
|
|
|
|
|
+ log.info("账户id:{},不使用dp链接;创建返回数据=====》》》》》》{}",token.getAccountId(),creativeObject);
|
|
|
|
+
|
|
if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
|
|
if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
|
|
List<Long> adIds = new ArrayList<>();
|
|
List<Long> adIds = new ArrayList<>();
|
|
adIds.add(adId);
|
|
adIds.add(adId);
|
|
@@ -254,7 +256,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
"创意创建失败",
|
|
"创意创建失败",
|
|
code,
|
|
code,
|
|
message,
|
|
message,
|
|
- "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+",creativeParams:"+creativeParams.toJSONString());
|
|
|
|
|
|
+ "marketingService.creativeCreate => token:"+ token.toString()+",adIds:"+adIds.toString()+"strategy:"+strategy.getAccountId()+",creativeParams:"+creativeParams.toJSONString());
|
|
iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
|
|
iBytedanceAutocreateLogService.save(iBytedanceAutocreateLog);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -279,7 +281,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
// 创建创意 拼接创意参数 master
|
|
// 创建创意 拼接创意参数 master
|
|
private JSONObject getCreativeParams(AiBytedanceAdvertiserStrategy strategy, Long adId,ByteDanceVideoInfo videoInfo,CtopOauthToken token) {
|
|
private JSONObject getCreativeParams(AiBytedanceAdvertiserStrategy strategy, Long adId,ByteDanceVideoInfo videoInfo,CtopOauthToken token) {
|
|
JSONObject params = new JSONObject();
|
|
JSONObject params = new JSONObject();
|
|
- params.put("advertiser_id", strategy.getAccountId());
|
|
|
|
|
|
+ params.put("advertiser_id", token.getAccountId());
|
|
params.put("ad_id", adId);
|
|
params.put("ad_id", adId);
|
|
|
|
|
|
/*基础创意*/
|
|
/*基础创意*/
|
|
@@ -552,7 +554,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
|
|
|
private Long createAdInfo(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, JSONObject adParams) {
|
|
private Long createAdInfo(CtopOauthToken token, AiBytedanceAdvertiserStrategy strategy, JSONObject adParams) {
|
|
Result result = marketingService.createAdvertiserPlan(token,adParams,strategy);
|
|
Result result = marketingService.createAdvertiserPlan(token,adParams,strategy);
|
|
- System.out.println(result);
|
|
|
|
|
|
+ log.info("账户id{}=====创建计划{}===",token.getAccountId(),result);
|
|
if(result.getCode()!=0){
|
|
if(result.getCode()!=0){
|
|
AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
strategy.getAccountId(),
|
|
strategy.getAccountId(),
|
|
@@ -1088,7 +1090,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
campaignParam.put("campaign_type",strategy.getCampaignType());
|
|
campaignParam.put("campaign_type",strategy.getCampaignType());
|
|
//创建组
|
|
//创建组
|
|
Result campaignData = marketingService.createCampaign(token, campaignParam);
|
|
Result campaignData = marketingService.createCampaign(token, campaignParam);
|
|
- log.info("===创建组==={}",campaignData);
|
|
|
|
|
|
+ log.info("账户id{}===创建组==={}",token.getAccountId(),campaignData);
|
|
if(campaignData.getCode()!=0){
|
|
if(campaignData.getCode()!=0){
|
|
AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
strategy.getAccountId(),
|
|
strategy.getAccountId(),
|