|
@@ -649,12 +649,18 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
if (!Check.isNull(strategy.getDeepConversionBid())) {
|
|
if (!Check.isNull(strategy.getDeepConversionBid())) {
|
|
unitParams.put("deep_conversion_bid", strategy.getDeepConversionBid());
|
|
unitParams.put("deep_conversion_bid", strategy.getDeepConversionBid());
|
|
}
|
|
}
|
|
- //资源位置
|
|
|
|
|
|
+
|
|
Integer sceneId = null;
|
|
Integer sceneId = null;
|
|
String scenceIdString = strategy.getSceneId();
|
|
String scenceIdString = strategy.getSceneId();
|
|
if (!Check.isNull(scenceIdString) && !Check.isNull(JSON.parseArray(scenceIdString))) {
|
|
if (!Check.isNull(scenceIdString) && !Check.isNull(JSON.parseArray(scenceIdString))) {
|
|
- sceneId = JSON.parseArray(strategy.getSceneId()).getInteger(0);
|
|
|
|
- unitParams.put("scene_id", JSON.parseArray(strategy.getSceneId()));
|
|
|
|
|
|
+ JSONArray scenceArray = JSON.parseArray(scenceIdString);
|
|
|
|
+ sceneId = scenceArray.getInteger(0);
|
|
|
|
+ //资源位置
|
|
|
|
+ if(unitType == 7){
|
|
|
|
+ //程序化
|
|
|
|
+ scenceArray = cleanPramgramErrorScence(scenceArray);
|
|
|
|
+ }
|
|
|
|
+ unitParams.put("scene_id", scenceArray);
|
|
}
|
|
}
|
|
|
|
|
|
//投放开始时间
|
|
//投放开始时间
|
|
@@ -806,6 +812,20 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
return unitParams;
|
|
return unitParams;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private JSONArray cleanPramgramErrorScence(JSONArray scenceArray) {
|
|
|
|
+ JSONArray result = new JSONArray();
|
|
|
|
+ if(null==scenceArray||scenceArray.isEmpty()){
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+ for (int i=0;i<scenceArray.size();i++){
|
|
|
|
+ Integer senceId =scenceArray.getInteger(i);
|
|
|
|
+ if(senceId!=5&&senceId!=3){
|
|
|
|
+ result.add(senceId);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return result;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取定向包
|
|
* 获取定向包
|
|
*
|
|
*
|
|
@@ -1038,8 +1058,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
private void createCreative(CtopOauthToken token, JSONObject creativeParams, Long campaignId, Long unitId,
|
|
private void createCreative(CtopOauthToken token, JSONObject creativeParams, Long campaignId, Long unitId,
|
|
int creativeCnt, KuaiShouVideoGet videoGet) {
|
|
int creativeCnt, KuaiShouVideoGet videoGet) {
|
|
creativeParams.put("creative_name", "自定义创意_" + creativeCnt);
|
|
creativeParams.put("creative_name", "自定义创意_" + creativeCnt);
|
|
- Map<String, Object> creativeCreateResult = kuaishouInterfaceService.creativeCreate
|
|
|
|
- (token.getAccessToken(), token.getAccountId(), creativeParams, 1);
|
|
|
|
|
|
+ Map<String, Object> creativeCreateResult = kuaishouInterfaceService.creativeCreate(token.getAccessToken(), token.getAccountId(), creativeParams, 1);
|
|
Integer creativeCode = (Integer) creativeCreateResult.get("code");
|
|
Integer creativeCode = (Integer) creativeCreateResult.get("code");
|
|
String creativeMessage = (String) creativeCreateResult.get("message");
|
|
String creativeMessage = (String) creativeCreateResult.get("message");
|
|
if (creativeCode != 0) {
|
|
if (creativeCode != 0) {
|
|
@@ -1061,10 +1080,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
* @param strategy 账户id
|
|
* @param strategy 账户id
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy,Integer num,Integer createType) {
|
|
|
|
- if(wildcard.contains("{{定向包}}")){
|
|
|
|
- String targetName = "";
|
|
|
|
- }
|
|
|
|
|
|
+ private String getName(String wildcard, AiKuaishouAdvertiserStrategy strategy,Integer num,Integer createType,AiKuaiShouAppInfo appInfo) {
|
|
|
|
+// if(wildcard.contains("{{定向包}}")){
|
|
|
|
+// String targetName = "";
|
|
|
|
+// }
|
|
if(wildcard.contains("{{日期}}")){
|
|
if(wildcard.contains("{{日期}}")){
|
|
String date = DateUtils.getNowDate("yyyyMMddHHmmss");
|
|
String date = DateUtils.getNowDate("yyyyMMddHHmmss");
|
|
wildcard.replace("{{日期}}","-"+date+"-");
|
|
wildcard.replace("{{日期}}","-"+date+"-");
|
|
@@ -1074,7 +1093,11 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
wildcard.replace("{{下标号}}","-"+numString+"-");
|
|
wildcard.replace("{{下标号}}","-"+numString+"-");
|
|
}
|
|
}
|
|
if(wildcard.contains("{{应用包名}}")){
|
|
if(wildcard.contains("{{应用包名}}")){
|
|
- String targetName = "";
|
|
|
|
|
|
+ String appName = "";
|
|
|
|
+ if(null!=appInfo){
|
|
|
|
+ appName = appInfo.getAppName();
|
|
|
|
+ }
|
|
|
|
+ wildcard.replace("{{应用包名}}","-"+appName+"-");
|
|
}
|
|
}
|
|
if(wildcard.contains("{{创意制作方式}}")){
|
|
if(wildcard.contains("{{创意制作方式}}")){
|
|
String creatype = KuaishouCreativeCreateTypeEnum.getNameByType(strategy.getOpenProgramCreate());
|
|
String creatype = KuaishouCreativeCreateTypeEnum.getNameByType(strategy.getOpenProgramCreate());
|
|
@@ -1088,6 +1111,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString()+createType.toString());
|
|
String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString()+createType.toString());
|
|
wildcard.replace("{{自定义}}","-"+targetName+"-");
|
|
wildcard.replace("{{自定义}}","-"+targetName+"-");
|
|
}
|
|
}
|
|
|
|
+ wildcard = wildcard.replace("--","-");
|
|
|
|
+ if(wildcard.startsWith("-")){
|
|
|
|
+ wildcard = wildcard.substring(1,wildcard.length());
|
|
|
|
+ }
|
|
|
|
+ if(wildcard.endsWith("-")){
|
|
|
|
+ wildcard = wildcard.substring(0,wildcard.length()-1);
|
|
|
|
+ }
|
|
return wildcard;
|
|
return wildcard;
|
|
}
|
|
}
|
|
|
|
|