|
@@ -127,7 +127,7 @@ 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, appInfo, timestamp, unitCnt);
|
|
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, unitCnt, videoItem.getPhotoName());
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
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");
|
|
@@ -185,7 +185,7 @@ 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, videoItem.getPhotoName());
|
|
|
|
|
|
Long appId = null;
|
|
Long appId = null;
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
@@ -295,7 +295,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
//创建组
|
|
//创建组
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, null);
|
|
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, appInfo, timestamp, null, null);
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
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");
|
|
@@ -338,7 +338,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
//创建组
|
|
//创建组
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
- String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null);
|
|
|
|
|
|
+ String unitName = getName(strategy.getGroupName(), strategy, createType, null, timestamp, null, null);
|
|
String appIdString = strategy.getAppIdArray();
|
|
String appIdString = strategy.getAppIdArray();
|
|
Long appId = null;
|
|
Long appId = null;
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
if (strategy.getCampaignType() == 2 || strategy.getCampaignType() == 7) {
|
|
@@ -612,6 +612,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
|
|
private Long getCampaignId(AiKuaishouAdvertiserStrategy strategy, CtopOauthToken token, String replaceString, String checkType, Integer createType, AiKuaiShouAppInfo appInfo, String uuid) {
|
|
// JSONArray campaignList;
|
|
// JSONArray campaignList;
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
@@ -644,7 +645,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
// 不存在“上新”计划,则创建一个计划
|
|
// 不存在“上新”计划,则创建一个计划
|
|
JSONObject campaignParams = new JSONObject();
|
|
JSONObject campaignParams = new JSONObject();
|
|
campaignParams.put("advertiser_id", token.getAccountId());
|
|
campaignParams.put("advertiser_id", token.getAccountId());
|
|
- String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, timestamp, null);
|
|
|
|
|
|
+ String campaignName = getName(strategy.getCampaignName(), strategy, createType, appInfo, timestamp, null, null);
|
|
campaignParams.put("campaign_name", campaignName);
|
|
campaignParams.put("campaign_name", campaignName);
|
|
campaignParams.put("type", strategy.getCampaignType());
|
|
campaignParams.put("type", strategy.getCampaignType());
|
|
if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
|
|
if (null != strategy.getCampaignDayBudget() && strategy.getCampaignDayBudget() != 0) {
|
|
@@ -1186,7 +1187,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
* @param strategy 账户id
|
|
* @param strategy 账户id
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String timestamp, Integer cnt) {
|
|
|
|
|
|
+ private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy, Integer createType, AiKuaiShouAppInfo appInfo, String timestamp, Integer cnt, String materialName) {
|
|
if (wildcard.contains("{{应用包名}}")) {
|
|
if (wildcard.contains("{{应用包名}}")) {
|
|
String appName = "";
|
|
String appName = "";
|
|
if (null != appInfo) {
|
|
if (null != appInfo) {
|
|
@@ -1207,6 +1208,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
String adsence = getAdSenceByParams(strategy.getSceneId());
|
|
String adsence = getAdSenceByParams(strategy.getSceneId());
|
|
wildcard = wildcard.replace("{{广告位置}}", adsence);
|
|
wildcard = wildcard.replace("{{广告位置}}", adsence);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (wildcard.contains("{{素材名称}}")) {
|
|
|
|
+ if (Check.isNull(materialName)) {
|
|
|
|
+ wildcard = wildcard.replace("{{素材名称}}", "");
|
|
|
|
+ } else {
|
|
|
|
+ wildcard = wildcard.replace("{{素材名称}}", materialName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
if (!wildcard.contains("{{自定义}}")) {
|
|
if (!wildcard.contains("{{自定义}}")) {
|
|
wildcard = wildcard + "{{自定义}}";
|
|
wildcard = wildcard + "{{自定义}}";
|
|
}
|
|
}
|