|
@@ -98,6 +98,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
|
|
log.info("账户:{},appid({}) 数据不存在", accountId, appIdArray.getLong(i));
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+
|
|
if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
|
|
if (null != strategy.getGeneralTrack() && strategy.getGeneralTrack() == 0) {
|
|
strategy.setClickTrackUrl(appInfo.getTrackUrl());
|
|
strategy.setClickTrackUrl(appInfo.getTrackUrl());
|
|
strategy.setImpressionUrl(appInfo.getTrackUrl());
|
|
strategy.setImpressionUrl(appInfo.getTrackUrl());
|
|
@@ -185,7 +186,12 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
unitCnt++;
|
|
unitCnt++;
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, unitCnt);
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, unitCnt);
|
|
- Long appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
|
|
|
|
|
|
+
|
|
|
|
+ Long appId = null;
|
|
|
|
+ if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
|
|
+ appId = JSONArray.parseArray(strategy.getAppIdArray()).getLong(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
@@ -327,7 +333,6 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (null == newCampaignId) {
|
|
if (null == newCampaignId) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
-
|
|
|
|
//创意
|
|
//创意
|
|
List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos, 5);
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
@@ -336,8 +341,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null);
|
|
String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null);
|
|
String appIdString = strategy.getAppIdArray();
|
|
String appIdString = strategy.getAppIdArray();
|
|
Long appId = null;
|
|
Long appId = null;
|
|
- if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
|
|
|
|
- appId = JSON.parseArray(appIdString).getLong(0);
|
|
|
|
|
|
+ if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
|
|
+ if (!Check.isNull(appIdString) && !Check.isNull(JSON.parseArray(appIdString))) {
|
|
|
|
+ appId = JSON.parseArray(appIdString).getLong(0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
@@ -667,6 +674,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
// 拼装创建组的入参 json
|
|
// 拼装创建组的入参 json
|
|
JSONObject unitParams = new JSONObject();
|
|
JSONObject unitParams = new JSONObject();
|
|
Integer unitType = strategy.getUnitType();
|
|
Integer unitType = strategy.getUnitType();
|
|
|
|
+
|
|
|
|
+
|
|
//创意制作方式
|
|
//创意制作方式
|
|
unitParams.put("unit_type", unitType);
|
|
unitParams.put("unit_type", unitType);
|
|
unitParams.put("advertiser_id", token.getAccountId());
|
|
unitParams.put("advertiser_id", token.getAccountId());
|
|
@@ -674,10 +683,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
unitParams.put("unit_name", unitName);
|
|
unitParams.put("unit_name", unitName);
|
|
//出价类型
|
|
//出价类型
|
|
unitParams.put("bid_type", strategy.getBidType());
|
|
unitParams.put("bid_type", strategy.getBidType());
|
|
- // 优先从系统应用商店下载
|
|
|
|
- if (null != strategy.getUseAppMarket()) {
|
|
|
|
- unitParams.put("use_app_market", strategy.getUseAppMarket());
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
//组单日预算
|
|
//组单日预算
|
|
if (null != strategy.getUnitDayBudget() && strategy.getUnitDayBudget() != 0) {
|
|
if (null != strategy.getUnitDayBudget() && strategy.getUnitDayBudget() != 0) {
|
|
unitParams.put("day_budget", strategy.getUnitDayBudget());
|
|
unitParams.put("day_budget", strategy.getUnitDayBudget());
|
|
@@ -685,9 +691,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
unitParams.put("day_budget", 0);
|
|
unitParams.put("day_budget", 0);
|
|
}
|
|
}
|
|
//应用商店列表
|
|
//应用商店列表
|
|
- if (null != strategy.getAppStore() && !"".equals(strategy.getAppStore())) {
|
|
|
|
- unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
|
|
unitParams.put("ocpx_action_type", strategy.getOcpxActionType());
|
|
|
|
|
|
//出价
|
|
//出价
|
|
@@ -724,14 +728,59 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(scenceIdString) && !Check.isNull(JSON.parseArray(scenceIdString))) {
|
|
if (!Check.isNull(scenceIdString) && !Check.isNull(JSON.parseArray(scenceIdString))) {
|
|
JSONArray scenceArray = JSON.parseArray(scenceIdString);
|
|
JSONArray scenceArray = JSON.parseArray(scenceIdString);
|
|
sceneId = scenceArray.getInteger(0);
|
|
sceneId = scenceArray.getInteger(0);
|
|
- //资源位置
|
|
|
|
- /* if (unitType == 7) {
|
|
|
|
- //程序化
|
|
|
|
- scenceArray = cleanPramgramErrorScence(scenceArray);
|
|
|
|
- }*/
|
|
|
|
unitParams.put("scene_id", scenceArray);
|
|
unitParams.put("scene_id", scenceArray);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ Integer campaignType = strategy.getCampaignType();
|
|
|
|
+ if (campaignType == 2) { // 提升应用安装
|
|
|
|
+ //应用ID
|
|
|
|
+ if (!Check.isNull(appId)) {
|
|
|
|
+ unitParams.put("app_id", appId);
|
|
|
|
+ }
|
|
|
|
+ // 优先从系统应用商店下载
|
|
|
|
+ if (null != strategy.getUseAppMarket()) {
|
|
|
|
+ unitParams.put("use_app_market", strategy.getUseAppMarket());
|
|
|
|
+ }
|
|
|
|
+ if (null != strategy.getAppStore() && !"".equals(strategy.getAppStore())) {
|
|
|
|
+ unitParams.put("app_store", JSON.parseArray(strategy.getAppStore()));
|
|
|
|
+ }
|
|
|
|
+ } else if (campaignType == 3) { // 获取电商下单
|
|
|
|
+
|
|
|
|
+ //url类型
|
|
|
|
+ if (!Check.isNull(strategy.getUrlType())) {
|
|
|
|
+ unitParams.put("url_type", strategy.getUrlType());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(strategy.getUrl())) {
|
|
|
|
+ unitParams.put("url", strategy.getUrl());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (campaignType == 5) { //收集销售线索
|
|
|
|
+ //url类型
|
|
|
|
+ if (!Check.isNull(strategy.getWebUriType())) {
|
|
|
|
+ unitParams.put("web_uri_type", strategy.getWebUriType());
|
|
|
|
+ }
|
|
|
|
+ //url
|
|
|
|
+ if (!Check.isNull(strategy.getUrl())) {
|
|
|
|
+ unitParams.put("url", strategy.getUrl());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (campaignType == 7) { // 提高应用活跃
|
|
|
|
+ // appId
|
|
|
|
+ if (!Check.isNull(appId)) {
|
|
|
|
+ unitParams.put("app_id", appId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // url
|
|
|
|
+ if (!Check.isNull(strategy.getUrl())) {
|
|
|
|
+ unitParams.put("url", strategy.getUrl());
|
|
|
|
+ }
|
|
|
|
+ //调起链接
|
|
|
|
+ if (!Check.isNull(strategy.getSchemaUri())) {
|
|
|
|
+ unitParams.put("schema_uri", strategy.getSchemaUri());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//投放开始时间
|
|
//投放开始时间
|
|
if (!Check.isNull(strategy.getBeginTime())) {
|
|
if (!Check.isNull(strategy.getBeginTime())) {
|
|
unitParams.put("begin_time", strategy.getBeginTime());
|
|
unitParams.put("begin_time", strategy.getBeginTime());
|
|
@@ -750,26 +799,8 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(strategy.getConvertId())) {
|
|
if (!Check.isNull(strategy.getConvertId())) {
|
|
unitParams.put("convert_id", strategy.getConvertId());
|
|
unitParams.put("convert_id", strategy.getConvertId());
|
|
}
|
|
}
|
|
- //url类型
|
|
|
|
- if (!Check.isNull(strategy.getUrlType())) {
|
|
|
|
- unitParams.put("url_type", strategy.getUrlType());
|
|
|
|
- }
|
|
|
|
- //url类型
|
|
|
|
- if (!Check.isNull(strategy.getWebUriType())) {
|
|
|
|
- unitParams.put("web_uri_type", strategy.getWebUriType());
|
|
|
|
- }
|
|
|
|
- //url
|
|
|
|
- if (!Check.isNull(strategy.getUrl())) {
|
|
|
|
- unitParams.put("url", strategy.getUrl());
|
|
|
|
- }
|
|
|
|
- //调起链接
|
|
|
|
- if (!Check.isNull(strategy.getSchemaUri())) {
|
|
|
|
- unitParams.put("schema_uri", strategy.getSchemaUri());
|
|
|
|
- }
|
|
|
|
- //应用ID
|
|
|
|
- if (!Check.isNull(appId)) {
|
|
|
|
- unitParams.put("app_id", appId);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//创意展现方式
|
|
//创意展现方式
|
|
if (!Check.isNull(strategy.getShowMode())) {
|
|
if (!Check.isNull(strategy.getShowMode())) {
|
|
unitParams.put("show_mode", strategy.getShowMode());
|
|
unitParams.put("show_mode", strategy.getShowMode());
|