|
@@ -67,7 +67,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
private MarketingService marketingService;
|
|
|
|
|
|
@Override
|
|
|
- public Long createCreative(AiBytedanceAdvertiserStrategy strategy,Integer createType, Long videoCnt,String openUrl) {
|
|
|
+ public Long createCreative(AiBytedanceAdvertiserStrategy strategy, Integer createType, Long videoCnt, String openUrl) {
|
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(strategy.getAccountId()+"");
|
|
|
if (null == token) {
|
|
|
log.info("token获取失败=>accountId:{}", token.getAccountId());
|
|
@@ -95,11 +95,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
* 查询当前账户排列到的dp链接标识号
|
|
|
*/
|
|
|
//根据dpLink获取组名称
|
|
|
- String campaignName = getCampaignName(strategy);
|
|
|
- Long campaignId = getCampaignId(strategy,campaignName,token);
|
|
|
- if(null == campaignId){
|
|
|
- return videoCnt;
|
|
|
- }
|
|
|
+
|
|
|
for (ByteDanceVideoInfo video:videoInfos) {
|
|
|
/**
|
|
|
* 2:创建计划
|
|
@@ -118,6 +114,11 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
log.info("此账户策略创建结束=>账户id:{};策略id:{}", token.getAccountId(),strategy.getId());
|
|
|
return 0L;
|
|
|
}
|
|
|
+ String campaignName = getCampaignName(strategy,dpIndex);
|
|
|
+ Long campaignId = getCampaignId(strategy,campaignName,token);
|
|
|
+ if(null == campaignId){
|
|
|
+ return videoCnt;
|
|
|
+ }
|
|
|
strategy.setAdOpenUrl(openUrl.replace("{{dp链接下标}}",dpIndex.toString()));
|
|
|
String dplinkCode = StringUtils.getParamFromUrl(strategy.getAdOpenUrl(),"bc_fl_src");
|
|
|
String adName = getAdName(strategy,dplinkCode,video);
|
|
@@ -860,10 +861,30 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
return (Long)campaignData.getResult();
|
|
|
}
|
|
|
|
|
|
- private String getCampaignName(AiBytedanceAdvertiserStrategy strategy) {
|
|
|
- String campaignName = strategy.getCampaignName();
|
|
|
- return campaignName+"-("+strategy.getDpLinkStartIndex()+"/"+strategy.getDpLinkEndIndex()+")";
|
|
|
+ private String getCampaignName(AiBytedanceAdvertiserStrategy strategy,Long dplinkIndex) {
|
|
|
+ String campaignSufix = getRangeIndex(strategy.getDpLinkStartIndex(),strategy.getDpLinkEndIndex(),strategy.getCampaignAdCnt(),dplinkIndex);
|
|
|
+ return strategy.getCampaignName()+campaignSufix;
|
|
|
}
|
|
|
+
|
|
|
+ private String getRangeIndex(Long dpLinkStartIndex,Long dpLinkEndIndex, Long campaignAdCnt, Long dpIndex) {
|
|
|
+ if(dpIndex<dpLinkStartIndex||dpIndex>dpLinkEndIndex){
|
|
|
+ //超出下标范围
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Long startIndex ;
|
|
|
+ Long endIndex ;
|
|
|
+ //计算当前下标值和范围区段的余数
|
|
|
+ Long yzIndex = (dpIndex-dpLinkStartIndex+1)%campaignAdCnt;
|
|
|
+ if(yzIndex == 0){
|
|
|
+ startIndex = dpIndex-campaignAdCnt+1;
|
|
|
+ endIndex = dpIndex;
|
|
|
+ }else{
|
|
|
+ startIndex = dpIndex-yzIndex+1;
|
|
|
+ endIndex = dpIndex-yzIndex+campaignAdCnt;
|
|
|
+ }
|
|
|
+ return "-("+startIndex+"/"+endIndex+")";
|
|
|
+ }
|
|
|
+
|
|
|
private List<ByteDanceVideoInfo> getVideoInfoByCreateType(Long projectId,AiBytedanceAdvertiserStrategy strategy, String startTime, String endTime, Integer createType, Long videoCnt) {
|
|
|
//1:上新素材 2:跑量素材 3:遗漏素材 4:打捞素材
|
|
|
if(createType == 1||createType == 3){
|