|
@@ -330,12 +330,17 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (null == newCampaignId) {
|
|
|
return videoCnt;
|
|
|
}
|
|
|
+ KuaishouChannel usedchannel = null;
|
|
|
if (useChannel == 1) {
|
|
|
- channel = channelService.queryUsedChannel(accountId, newCampaignId, level);
|
|
|
- if (Check.isNull(channel)) {
|
|
|
- return videoCnt;
|
|
|
+ usedchannel = channelService.queryUsedChannel(accountId, newCampaignId, level);
|
|
|
+ if (Check.isNull(usedchannel)) {
|
|
|
+ if ("account".equals(level)) {
|
|
|
+ usedchannel = channel;
|
|
|
+ } else {
|
|
|
+ return videoCnt;
|
|
|
+ }
|
|
|
}
|
|
|
- List<KuaishouChannelItems> items = channel.getItems();
|
|
|
+ List<KuaishouChannelItems> items = usedchannel.getItems();
|
|
|
if (!Check.isNull(items) && !items.isEmpty()) {
|
|
|
strategy.setMaterialKeyword(items.get(0).getKeyword());
|
|
|
}
|
|
@@ -369,12 +374,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
Result<Object> result = channelService.queryChannel(accountId, level, appName, videoItem.getPhotoName());
|
|
|
Integer code = result.getCode();
|
|
|
if (code == 200) {
|
|
|
- channel = (KuaishouChannel) result.getResult();
|
|
|
- if (Check.isNull(channel)) {
|
|
|
+ usedchannel = (KuaishouChannel) result.getResult();
|
|
|
+ if (Check.isNull(usedchannel)) {
|
|
|
log.info("(组级)账户:{},{}", accountId, result.getMessage());
|
|
|
continue;
|
|
|
} else {
|
|
|
- log.info("(组级)获取到渠道号:{}", channel.getChannelCode());
|
|
|
+ log.info("(组级)获取到渠道号:{}", usedchannel.getChannelCode());
|
|
|
}
|
|
|
} else {
|
|
|
log.error("(组级)通过账户(" + accountId + ")未获取到渠道号!!!");
|
|
@@ -384,8 +389,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId, channel);
|
|
|
- JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, channel);
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, videoItem.getPhotoName(), "unit", newCampaignId, appId, usedchannel);
|
|
|
+ JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, usedchannel);
|
|
|
log.info("创建广告组入参:{}", unitParams);
|
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
@@ -405,8 +410,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (unitCode != 0) {
|
|
|
log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
- if (!Check.isNull(channel)) {
|
|
|
- channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null, 0);
|
|
|
+ if (!Check.isNull(usedchannel)) {
|
|
|
+ channelService.callBackUpdateChannelRel(level, usedchannel.getChannelCode(), accountId, newCampaignId, null, 0);
|
|
|
}
|
|
|
continue;
|
|
|
}
|
|
@@ -414,10 +419,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
unitLevelOperationRecord.setUnitId(unitId);
|
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
videoCnt--;
|
|
|
- if (!Check.isNull(channel)) {
|
|
|
- channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId, 1);
|
|
|
+ if (!Check.isNull(usedchannel)) {
|
|
|
+ channelService.callBackUpdateChannelRel(level, usedchannel.getChannelCode(), accountId, newCampaignId, unitId, 1);
|
|
|
}
|
|
|
- JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, channel);//TODO 添加素材
|
|
|
+ JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy, usedchannel);//TODO 添加素材
|
|
|
createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
|
|
|
if (videoCnt <= 0) {
|
|
|
return 0L;
|
|
@@ -678,12 +683,17 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (null == newCampaignId) {
|
|
|
return;
|
|
|
}
|
|
|
+ KuaishouChannel usedchannel = null;
|
|
|
if (useChannel == 1) {
|
|
|
- channel = channelService.queryUsedChannel(accountId, newCampaignId, level);
|
|
|
- if (Check.isNull(channel)) {
|
|
|
- return;
|
|
|
+ usedchannel = channelService.queryUsedChannel(accountId, newCampaignId, level);
|
|
|
+ if (Check.isNull(usedchannel)) {
|
|
|
+ if ("account".equals(level)) {
|
|
|
+ usedchannel = channel;
|
|
|
+ } else {
|
|
|
+ return ;
|
|
|
+ }
|
|
|
}
|
|
|
- List<KuaishouChannelItems> items = channel.getItems();
|
|
|
+ List<KuaishouChannelItems> items = usedchannel.getItems();
|
|
|
if (!Check.isNull(items) && !items.isEmpty()) {
|
|
|
strategy.setMaterialKeyword(items.get(0).getKeyword());
|
|
|
}
|
|
@@ -719,12 +729,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
Result<Object> result = channelService.queryChannel(accountId, level, appName, videoGet.getPhotoName());
|
|
|
Integer code = result.getCode();
|
|
|
if (code == 200) {
|
|
|
- channel = (KuaishouChannel) result.getResult();
|
|
|
- if (Check.isNull(channel)) {
|
|
|
+ usedchannel = (KuaishouChannel) result.getResult();
|
|
|
+ if (Check.isNull(usedchannel)) {
|
|
|
log.info("(组级)账户:{},{}", accountId, result.getMessage());
|
|
|
continue;
|
|
|
} else {
|
|
|
- log.info("(组级)获取到渠道号:{}", channel.getChannelCode());
|
|
|
+ log.info("(组级)获取到渠道号:{}", usedchannel.getChannelCode());
|
|
|
}
|
|
|
} else {
|
|
|
log.error("(组级)通过账户(" + accountId + ")未获取到渠道号!!!");
|
|
@@ -736,8 +746,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
}
|
|
|
|
|
|
//创建组
|
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId, channel);
|
|
|
- JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, channel);
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, null, "unit", newCampaignId, appId, usedchannel); JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId, usedchannel);
|
|
|
log.info("创建广告组入参:{}", unitParams);
|
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
@@ -757,8 +766,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (unitCode != 0) {
|
|
|
log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
- if (!Check.isNull(channel)) {
|
|
|
- channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, null, 0);
|
|
|
+ if (!Check.isNull(usedchannel)) {
|
|
|
+ channelService.callBackUpdateChannelRel(level, usedchannel.getChannelCode(), accountId, newCampaignId, null, 0);
|
|
|
}
|
|
|
return;
|
|
|
}
|
|
@@ -768,7 +777,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (!Check.isNull(channel)) {
|
|
|
channelService.callBackUpdateChannelRel(level, channel.getChannelCode(), accountId, newCampaignId, unitId, 1);
|
|
|
}
|
|
|
- JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null, channel);
|
|
|
+ JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j, null, usedchannel);
|
|
|
createProgramCreative(token, creativeParams, strategy);
|
|
|
}
|
|
|
}
|