|
@@ -84,6 +84,8 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
return;
|
|
|
}
|
|
|
String materialFixType = strategyTemplate.getMaterialFixType();
|
|
|
+ Date campaignDate = new Date();
|
|
|
+ String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMddHHmmss");
|
|
|
if(scenes.equals("1")){
|
|
|
//素材+出价
|
|
|
List<Long>getCapbids = splitCapBidByDomain(strategy.getCpaBidMin(),strategy.getCpaBidMax(),strategy.getStepSize());
|
|
@@ -94,9 +96,7 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
//7、一个计划,拼装创建计划的入参json
|
|
|
JSONObject campaignParams = new JSONObject();
|
|
|
campaignParams.put("advertiser_id",token.getAccountId());
|
|
|
- Date campaignDate = new Date();
|
|
|
- String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMdd");
|
|
|
- String campaignName = "户14-上下滑&信息流" + "自定义01"+ "剪辑-低价-低价包邮-活动-年龄18岁以上-单出价-"+ timestamp;
|
|
|
+ String campaignName = "户14-上下滑&信息流" + "-自定义001"+ "剪辑-低价-低价包邮-活动-年龄18岁以上-单出价-"+ timestamp;
|
|
|
campaignParams.put("campaign_name",campaignName);
|
|
|
campaignParams.put("type",Integer.parseInt(strategy.getMarketingGoal()));
|
|
|
campaignParams.put("day_budget",0L);
|
|
@@ -116,6 +116,7 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
// 选择素材,创建创意
|
|
|
for(KuaiShouVideoGet videoItem: videoGets){
|
|
|
//拼装广告组参数
|
|
|
+ unitCnt ++;
|
|
|
String unitName = campaignName + "-" + unitCnt;
|
|
|
JSONObject unitParams = createUnitParams(token, campaignId, strategy, item, unitName);
|
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
|
|
@@ -145,7 +146,6 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
createCreativeByImage(cutFrameList,orgFrameList,token,creativeParams,campaignId,unitId,strategy,videoItem,15,null);
|
|
|
}
|
|
|
}
|
|
|
- unitCnt ++;
|
|
|
}else{
|
|
|
//混搭素材逻辑
|
|
|
String unitName = campaignName + "-" + unitCnt;
|
|
@@ -205,9 +205,7 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
//7、一个计划,拼装创建计划的入参json
|
|
|
JSONObject campaignParams = new JSONObject();
|
|
|
campaignParams.put("advertiser_id",token.getAccountId());
|
|
|
- Date campaignDate = new Date();
|
|
|
- String timestamp = DateUtils.formatDate(campaignDate,"yyyyMMdd");
|
|
|
- String campaignName = "户14-上下滑&信息流" + "通投01"+ "剪辑-低价-低价包邮-活动-年龄18岁以上-单出价-"+ timestamp;
|
|
|
+ String campaignName = "户14-上下滑&信息流" + "-通投001"+ "剪辑-低价-低价包邮-活动-年龄18岁以上-单出价-"+ timestamp;
|
|
|
campaignParams.put("campaign_name",campaignName);
|
|
|
campaignParams.put("type",Integer.parseInt(strategy.getMarketingGoal()));
|
|
|
campaignParams.put("day_budget",0L);
|
|
@@ -222,8 +220,6 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
int unitCnt = 0;
|
|
|
// 8、根据定向和素材,两层循环 创建组和创意
|
|
|
for (AiKuaishouStrategyTargetBase item:getBases) {
|
|
|
- unitCnt++;
|
|
|
- String unitName = campaignName + "-" + unitCnt;
|
|
|
if(null!=materialFixType&&materialFixType.trim().equals("single")){
|
|
|
// 策略定向拆分数据,写入数据库
|
|
|
AiKuaishouStrategyTargetUnion targetUnion = new AiKuaishouStrategyTargetUnion(strategyMiddle.getId(),item.getId(),item.getTargetContent());
|
|
@@ -231,6 +227,8 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
// 选择素材,创建创意
|
|
|
for(KuaiShouVideoGet videoItem: videoGets){
|
|
|
//拼装广告组参数
|
|
|
+ unitCnt++;
|
|
|
+ String unitName = campaignName + "-" + unitCnt;
|
|
|
JSONObject unitParams = createUnitParams(token,campaignId,strategy,strategyTemplate, item,timestamp,unitName);
|
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
|
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
@@ -265,10 +263,9 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
targetUnionService.save(targetUnion);
|
|
|
// 选择素材,创建创意
|
|
|
for(KuaiShouVideoGet videoItem: videoGets){
|
|
|
- //拼装广告组参数
|
|
|
-
|
|
|
-
|
|
|
- JSONObject unitParams = createUnitParams(token,campaignId,strategy,strategyTemplate, item,timestamp,unitCnt);
|
|
|
+ unitCnt++;
|
|
|
+ String unitName = campaignName + "-" + unitCnt;
|
|
|
+ JSONObject unitParams = createUnitParams(token,campaignId,strategy,strategyTemplate, item,timestamp,unitName);
|
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams,1);
|
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
|
String unitMessage = (String) unitCreateResult.get("message");
|
|
@@ -389,7 +386,7 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
}
|
|
|
JSONArray excludePopulation = JSONArray.parseArray(strategy.getExcludePopulation());
|
|
|
if(null!=excludePopulation&&!excludePopulation.isEmpty()){
|
|
|
- targetJsonObject.put("paid_audience",excludePopulation);
|
|
|
+ targetJsonObject.put("exclude_population",excludePopulation);
|
|
|
}
|
|
|
|
|
|
unitParams.put("target",targetJsonObject);
|
|
@@ -424,11 +421,9 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
creativeParams.put("advertiser_id",token.getAccountId());
|
|
|
creativeParams.put("unit_id",unitId);
|
|
|
creativeParams.put("photo_id",videoItem.getPhotoId());
|
|
|
- String uuid = UUID.randomUUID().toString();
|
|
|
- creativeParams.put("creative_name","智能创意-"+uuid+unitCnt+"-"+1);
|
|
|
creativeParams.put("creative_material_type",videoItem.getMaterialType());
|
|
|
- creativeParams.put("action_bar_text","立即下载");
|
|
|
- creativeParams.put("description","太美了!来电显示设为视频铃声,来电话就开始播放~");
|
|
|
+ creativeParams.put("action_bar_text","下载抢购");
|
|
|
+ creativeParams.put("description","不买亏大了!众多商品低至一元!看看你多花了多少冤枉钱!");
|
|
|
// 安卓下载中间页ID
|
|
|
JSONArray siteIdArray = JSONArray.parseArray(strategy.getSiteId());
|
|
|
if(null == siteIdArray||!siteIdArray.isEmpty()){
|
|
@@ -557,7 +552,7 @@ public class AiStrategyServiceImpl implements IAiStrategyService {
|
|
|
}
|
|
|
private void createCreative(CtopOauthToken token,JSONObject creativeParams,Long campaignId,Long unitId,
|
|
|
KuaishouStrategy strategy,AiKuaishouStrategyTargetUnion targetUnion,int creativeCnt,KuaiShouVideoGet videoGet){
|
|
|
- creativeParams.put("creative_name",creativeParams.getString("creative_name")+creativeCnt);
|
|
|
+ creativeParams.put("creative_name","自定义创意_竖版视频_"+creativeCnt);
|
|
|
Map<String, Object> creativeCreateResult = kuaishouInterfaceService.creativeCreate
|
|
|
(token.getAccessToken(), token.getAccountId(), creativeParams,1);
|
|
|
Integer creativeCode = (Integer) creativeCreateResult.get("code");
|