|
@@ -136,8 +136,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
|
|
|
//不使用dp链接
|
|
|
- String date = DateUtils.formatDate();
|
|
|
- String campaignName = getCampaignName(strategy,null,date);
|
|
|
+
|
|
|
+ //组名称
|
|
|
+ String campaignName = getCampaignName(strategy,null,null);
|
|
|
+ //创建组 并返回 组id
|
|
|
Long campaignId = getCampaignId(strategy,campaignName,token);
|
|
|
if(null == campaignId){
|
|
|
return videoCnt;
|
|
@@ -193,6 +195,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
//组名称
|
|
|
String campaignName = getCampaignName(strategy,dpIndex,null);
|
|
|
+ //创建组 并返回 组id
|
|
|
Long campaignId = getCampaignId(strategy,campaignName,token);
|
|
|
if(null == campaignId){
|
|
|
return videoCnt;
|
|
@@ -831,12 +834,14 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
if(!Check.isNull(strategy.getAdScheduleType())){
|
|
|
params.put("schedule_type",strategy.getAdScheduleType());
|
|
|
}
|
|
|
- if(!Check.isNull(strategy.getAdStartTime())){
|
|
|
- params.put("start_time",strategy.getAdStartTime());
|
|
|
- }
|
|
|
- if(!Check.isNull(strategy.getAdAdjustCpa())){
|
|
|
- params.put("end_time",strategy.getAdEndTime());
|
|
|
+
|
|
|
+ //总预算 必须设置 起始时间
|
|
|
+ if ("BUDGET_MODE_TOTAL".equalsIgnoreCase(strategy.getAdBudgetMode())){
|
|
|
+ params.put("start_time",strategy.getAdStartTime()+" 00:00");
|
|
|
+ params.put("end_time",strategy.getAdEndTime()+" 00:00");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
if(!Check.isNull(strategy.getAdScheduleTime())){
|
|
|
params.put("schedule_time",strategy.getAdScheduleTime());
|
|
|
}
|
|
@@ -884,6 +889,10 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
adName = adName.replace("{{素材名称}}",info.getMaterialName());
|
|
|
}
|
|
|
}
|
|
|
+ if(adName.contains("{{序号}}")){
|
|
|
+ int i = adDplinkInfoService.getDpLinkInfoCount(strategy.getAccountId());
|
|
|
+ adName = adName.replace("{{序号}}",String.valueOf(i+1));
|
|
|
+ }
|
|
|
adName = adName.replace("--","-");
|
|
|
if(adName.startsWith("-")){
|
|
|
adName = adName.substring(1);
|
|
@@ -896,6 +905,15 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 创建 组
|
|
|
+ * 如果已有组信息 则 返回组id
|
|
|
+ * 没有则 新建
|
|
|
+ * @param strategy
|
|
|
+ * @param campaignName
|
|
|
+ * @param token
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private Long getCampaignId(AiBytedanceAdvertiserStrategy strategy, String campaignName,CtopOauthToken token) {
|
|
|
ByteDanceCampaign campaign = campaignService.getOneByParams(strategy.getAccountId(),campaignName);
|
|
|
if(null != campaign){
|
|
@@ -929,13 +947,26 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
|
|
|
private String getCampaignName(AiBytedanceAdvertiserStrategy strategy,Long dplinkIndex,String date) {
|
|
|
String result = strategy.getCampaignName();
|
|
|
- if(null!=dplinkIndex&&dplinkIndex!=0){
|
|
|
+ if(null != dplinkIndex && dplinkIndex !=0){
|
|
|
String campaignSufix = getRangeIndex(strategy.getDpLinkStartIndex(),strategy.getDpLinkEndIndex(),strategy.getCampaignAdCnt(),dplinkIndex);
|
|
|
- result = result+campaignSufix;
|
|
|
+ result = result + campaignSufix;
|
|
|
+ }
|
|
|
+ if(result.contains("{{日期}}")){
|
|
|
+ String time = DateUtils.formatDate(new Date(),"yyyyMMdd");
|
|
|
+ result = result.replace("{{日期}}",time);
|
|
|
+ }
|
|
|
+ if(result.contains("{{序号}}")){
|
|
|
+ int i = adDplinkInfoService.getDpLinkInfoCount(strategy.getAccountId());
|
|
|
+ result = result.replace("{{序号}}",String.valueOf(i+1));
|
|
|
+ }
|
|
|
+ result = result.replace("--","-");
|
|
|
+ if(result.startsWith("-")){
|
|
|
+ result = result.substring(1);
|
|
|
}
|
|
|
- if(null!=date&&!date.trim().equals("")){
|
|
|
- result = result +"-"+date;
|
|
|
+ if(result.endsWith("-")){
|
|
|
+ result = result.substring(0,result.length()-1);
|
|
|
}
|
|
|
+ result = result.replace("--","-");
|
|
|
return result;
|
|
|
}
|
|
|
|