|
@@ -170,13 +170,18 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
unitJson.put("campaign_id", campaignId);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 资源位置
|
|
|
JSONArray scene_id = requestJson.getJSONArray("sceneId");
|
|
|
if (!Check.isNull(scene_id)) {
|
|
|
unitJson.put("scene_id", scene_id);
|
|
|
}
|
|
|
Integer sceneId = valueOf(scene_id.get(0).toString());
|
|
|
+
|
|
|
+ // 智能定向
|
|
|
+ Boolean autoTarget = requestJson.getBoolean("autoTarget");
|
|
|
+ if (!Check.isNull(autoTarget)) {
|
|
|
+ unitJson.put("auto_target", autoTarget);
|
|
|
+ }
|
|
|
// 资源创作方式
|
|
|
Integer unitType = requestJson.getInteger("unitType");
|
|
|
if (!Check.isNull(unitType)) {
|
|
@@ -239,126 +244,123 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
if (!Check.isNull(requestJson.getInteger("speed"))) {
|
|
|
unitJson.put("speed", requestJson.getInteger("speed"));
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- // -----------------用户定向-----------
|
|
|
- JSONObject targetJson = new JSONObject();
|
|
|
-
|
|
|
- // 地域
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("region"))) {
|
|
|
- targetJson.put("region", requestJson.getJSONArray("region"));
|
|
|
- }
|
|
|
-
|
|
|
- // 自定义年龄段
|
|
|
- JSONArray ageArr = requestJson.getJSONArray("age");
|
|
|
- if (!Check.isNull(ageArr)) {
|
|
|
- JSONObject ageJson = new JSONObject();
|
|
|
- ageJson.put("min", ageArr.get(0));
|
|
|
- ageJson.put("max", ageArr.get(1));
|
|
|
- targetJson.put("age", ageJson);
|
|
|
- }
|
|
|
- // 固定年龄段
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("agesRange"))) {
|
|
|
- targetJson.put("ages_range", requestJson.getJSONArray("agesRange"));
|
|
|
- }
|
|
|
- // 性别
|
|
|
- if (!Check.isNull(requestJson.getInteger("gender"))) {
|
|
|
- targetJson.put("gender", requestJson.getInteger("gender"));
|
|
|
- }
|
|
|
- //操作系统
|
|
|
- if (!Check.isNull(requestJson.getInteger("platformOs"))) {
|
|
|
- targetJson.put("platform_os", requestJson.getInteger("platformOs"));
|
|
|
- }
|
|
|
- //Android版本
|
|
|
- if (!Check.isNull(requestJson.getInteger("androidOsv"))) {
|
|
|
- targetJson.put("android_osv", requestJson.getInteger("androidOsv"));
|
|
|
- }
|
|
|
- // iOS版本
|
|
|
- if (!Check.isNull(requestJson.getInteger("iosOsv"))) {
|
|
|
- targetJson.put("ios_osv", requestJson.getInteger("iosOsv"));
|
|
|
- }
|
|
|
- //网络环境
|
|
|
- if (!Check.isNull(requestJson.getInteger("network"))) {
|
|
|
- targetJson.put("network", requestJson.getInteger("network"));
|
|
|
- }
|
|
|
- //设备品牌
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
|
|
|
- targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
|
|
|
- }
|
|
|
- //设备价格
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
|
|
|
- targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
|
|
|
- }
|
|
|
-
|
|
|
- if (sceneId != 5) {
|
|
|
- //过滤已转化人群纬度
|
|
|
- if (!Check.isNull(requestJson.getInteger("filterConvertedLevel"))) {
|
|
|
- targetJson.put("filter_converted_level", requestJson.getInteger("filterConvertedLevel"));
|
|
|
+ Long templateId = requestJson.getLong("templateId");
|
|
|
+ if (!Check.isNull(templateId)) {
|
|
|
+ unitJson.put("template_id", templateId);
|
|
|
+ } else {
|
|
|
+ // -----------------用户定向-----------
|
|
|
+ JSONObject targetJson = new JSONObject();
|
|
|
+ // 地域
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("region"))) {
|
|
|
+ targetJson.put("region", requestJson.getJSONArray("region"));
|
|
|
}
|
|
|
- //商业兴趣类型
|
|
|
- if (!Check.isNull(requestJson.getInteger("businessInterestType"))) {
|
|
|
- targetJson.put("business_interest_type", requestJson.getInteger("businessInterestType"));
|
|
|
+ // 自定义年龄段
|
|
|
+ JSONArray ageArr = requestJson.getJSONArray("age");
|
|
|
+ if (!Check.isNull(ageArr)) {
|
|
|
+ JSONObject ageJson = new JSONObject();
|
|
|
+ ageJson.put("min", ageArr.get(0));
|
|
|
+ ageJson.put("max", ageArr.get(1));
|
|
|
+ targetJson.put("age", ageJson);
|
|
|
}
|
|
|
- // 商业兴趣
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("businessInterest"))) {
|
|
|
- targetJson.put("business_interest", requestJson.getJSONArray("businessInterest"));
|
|
|
+ // 固定年龄段
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("agesRange"))) {
|
|
|
+ targetJson.put("ages_range", requestJson.getJSONArray("agesRange"));
|
|
|
}
|
|
|
- //网红粉丝
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("fansStar"))) {
|
|
|
- targetJson.put("fans_star", requestJson.getJSONArray("fansStar"));
|
|
|
+ // 性别
|
|
|
+ if (!Check.isNull(requestJson.getInteger("gender"))) {
|
|
|
+ targetJson.put("gender", requestJson.getInteger("gender"));
|
|
|
}
|
|
|
- //兴趣视频用户
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("interestVideo"))) {
|
|
|
- targetJson.put("interest_video", requestJson.getJSONArray("interestVideo"));
|
|
|
+ //操作系统
|
|
|
+ if (!Check.isNull(requestJson.getInteger("platformOs"))) {
|
|
|
+ targetJson.put("platform_os", requestJson.getInteger("platformOs"));
|
|
|
+ }
|
|
|
+ //Android版本
|
|
|
+ if (!Check.isNull(requestJson.getInteger("androidOsv"))) {
|
|
|
+ targetJson.put("android_osv", requestJson.getInteger("androidOsv"));
|
|
|
+ }
|
|
|
+ // iOS版本
|
|
|
+ if (!Check.isNull(requestJson.getInteger("iosOsv"))) {
|
|
|
+ targetJson.put("ios_osv", requestJson.getInteger("iosOsv"));
|
|
|
+ }
|
|
|
+ //网络环境
|
|
|
+ if (!Check.isNull(requestJson.getInteger("network"))) {
|
|
|
+ targetJson.put("network", requestJson.getInteger("network"));
|
|
|
+ }
|
|
|
+ //设备品牌
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("deviceBrand"))) {
|
|
|
+ targetJson.put("device_brand", requestJson.getJSONArray("deviceBrand"));
|
|
|
+ }
|
|
|
+ //设备价格
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("devicePrice"))) {
|
|
|
+ targetJson.put("device_price", requestJson.getJSONArray("devicePrice"));
|
|
|
}
|
|
|
- }
|
|
|
- // APP行为-按分类
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
|
|
|
- targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
|
|
|
- }
|
|
|
- // APP行为-按APP名称
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("appIds"))) {
|
|
|
- targetJson.put("app_ids", requestJson.getJSONArray("appIds"));
|
|
|
- }
|
|
|
- // 人群包定向
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("population"))) {
|
|
|
- targetJson.put("population", requestJson.getJSONArray("population"));
|
|
|
- }
|
|
|
- // 人群包排除
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("excludePopulation"))) {
|
|
|
- targetJson.put("exclude_population", requestJson.getJSONArray("excludePopulation"));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if (!Check.isNull(requestJson.getJSONArray("thirdPlatformCode"))) {
|
|
|
- targetJson.put("third_platform_code", requestJson.getJSONArray("thirdPlatformCode"));
|
|
|
- }
|
|
|
-
|
|
|
- if (sceneId != 5) {
|
|
|
- JSONObject intelliExtendJson = new JSONObject();
|
|
|
|
|
|
- // 开启智能扩量
|
|
|
- if (!Check.isNull(requestJson.getInteger("isOpen"))) {
|
|
|
- intelliExtendJson.put("is_open", requestJson.getInteger("isOpen"));
|
|
|
+ if (sceneId != 5) {
|
|
|
+ //过滤已转化人群纬度
|
|
|
+ if (!Check.isNull(requestJson.getInteger("filterConvertedLevel"))) {
|
|
|
+ targetJson.put("filter_converted_level", requestJson.getInteger("filterConvertedLevel"));
|
|
|
+ }
|
|
|
+ //商业兴趣类型
|
|
|
+ if (!Check.isNull(requestJson.getInteger("businessInterestType"))) {
|
|
|
+ targetJson.put("business_interest_type", requestJson.getInteger("businessInterestType"));
|
|
|
+ }
|
|
|
+ // 商业兴趣
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("businessInterest"))) {
|
|
|
+ targetJson.put("business_interest", requestJson.getJSONArray("businessInterest"));
|
|
|
+ }
|
|
|
+ //网红粉丝
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("fansStar"))) {
|
|
|
+ targetJson.put("fans_star", requestJson.getJSONArray("fansStar"));
|
|
|
+ }
|
|
|
+ //兴趣视频用户
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("interestVideo"))) {
|
|
|
+ targetJson.put("interest_video", requestJson.getJSONArray("interestVideo"));
|
|
|
+ }
|
|
|
}
|
|
|
- //不可突破年龄
|
|
|
- if (!Check.isNull(requestJson.getInteger("noAgeBreak"))) {
|
|
|
- intelliExtendJson.put("no_age_break", requestJson.getInteger("noAgeBreak"));
|
|
|
+ // APP行为-按分类
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("appInterest"))) {
|
|
|
+ targetJson.put("app_interest", requestJson.getJSONArray("appInterest"));
|
|
|
}
|
|
|
- //不可突破性别
|
|
|
- if (!Check.isNull(requestJson.getInteger("noGenderBreak"))) {
|
|
|
- intelliExtendJson.put("no_gender_break", requestJson.getInteger("noGenderBreak"));
|
|
|
+ // APP行为-按APP名称
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("appIds"))) {
|
|
|
+ targetJson.put("app_ids", requestJson.getJSONArray("appIds"));
|
|
|
+ }
|
|
|
+ // 人群包定向
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("population"))) {
|
|
|
+ targetJson.put("population", requestJson.getJSONArray("population"));
|
|
|
}
|
|
|
- // 不可突破地域
|
|
|
- if (!Check.isNull(requestJson.getInteger("noAreaBreak"))) {
|
|
|
- intelliExtendJson.put("no_area_break", requestJson.getInteger("noAreaBreak"));
|
|
|
+ // 人群包排除
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("excludePopulation"))) {
|
|
|
+ targetJson.put("exclude_population", requestJson.getJSONArray("excludePopulation"));
|
|
|
}
|
|
|
- if (!Check.isNull(intelliExtendJson)) {
|
|
|
- targetJson.put("intelli_extend", intelliExtendJson);
|
|
|
+ if (!Check.isNull(requestJson.getJSONArray("thirdPlatformCode"))) {
|
|
|
+ targetJson.put("third_platform_code", requestJson.getJSONArray("thirdPlatformCode"));
|
|
|
}
|
|
|
- }
|
|
|
+ if (sceneId != 5) {
|
|
|
+ JSONObject intelliExtendJson = new JSONObject();
|
|
|
|
|
|
- unitJson.put("target", targetJson);
|
|
|
+ // 开启智能扩量
|
|
|
+ if (!Check.isNull(requestJson.getInteger("isOpen"))) {
|
|
|
+ intelliExtendJson.put("is_open", requestJson.getInteger("isOpen"));
|
|
|
+ }
|
|
|
+ //不可突破年龄
|
|
|
+ if (!Check.isNull(requestJson.getInteger("noAgeBreak"))) {
|
|
|
+ intelliExtendJson.put("no_age_break", requestJson.getInteger("noAgeBreak"));
|
|
|
+ }
|
|
|
+ //不可突破性别
|
|
|
+ if (!Check.isNull(requestJson.getInteger("noGenderBreak"))) {
|
|
|
+ intelliExtendJson.put("no_gender_break", requestJson.getInteger("noGenderBreak"));
|
|
|
+ }
|
|
|
+ // 不可突破地域
|
|
|
+ if (!Check.isNull(requestJson.getInteger("noAreaBreak"))) {
|
|
|
+ intelliExtendJson.put("no_area_break", requestJson.getInteger("noAreaBreak"));
|
|
|
+ }
|
|
|
+ if (!Check.isNull(intelliExtendJson)) {
|
|
|
+ targetJson.put("intelli_extend", intelliExtendJson);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ unitJson.put("target", targetJson);
|
|
|
+ }
|
|
|
JSONArray groupArr = requestJson.getJSONArray("groupArr");
|
|
|
if (Check.isNull(groupArr)) {
|
|
|
throw new Exception("请输入需要创建的广告组");
|
|
@@ -370,12 +372,9 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
returnJson.put("total", groupArr.size());
|
|
|
JSONArray successArr = new JSONArray();
|
|
|
JSONArray failArr = new JSONArray();
|
|
|
-
|
|
|
-
|
|
|
for (int i = 0; i < groupArr.size(); i++) {
|
|
|
JSONObject groupJson = groupArr.getJSONObject(i);
|
|
|
if (!Check.isNull(groupJson)) {
|
|
|
-
|
|
|
// 出价
|
|
|
if (!Check.isNull(groupJson.getLong("bid"))) {
|
|
|
unitJson.put("bid", groupJson.getLong("bid"));
|
|
@@ -406,7 +405,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
if (!Check.isNull(unitName)) {
|
|
|
unitJson.put("unit_name", unitName);
|
|
|
}
|
|
|
-
|
|
|
Map<String, Object> returnUnitMap = kuaishouInterfaceService.adUnitCreate(oauthToken.getAccessToken(), oauthToken.getAccountId(), unitJson, 1);
|
|
|
if (!Check.isNullMap(returnUnitMap)) {
|
|
|
Integer code = (Integer) returnUnitMap.get("code");
|
|
@@ -419,7 +417,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
successJson.put("ocpxActionType", ocpx_action_type);
|
|
|
successJson.put("unitType", unitType);
|
|
|
successArr.add(successJson);
|
|
|
-
|
|
|
if (!Check.isNull(type) && "copy".equals(type)) {
|
|
|
Long copyUnitId = requestJson.getLong("copyUnitId");
|
|
|
if (!Check.isNull(unitId) && !Check.isNull(copyUnitId)) {
|
|
@@ -443,13 +440,9 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
failJson.put("failMessage", returnUnitMap.get("message"));
|
|
|
failArr.add(failJson);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
returnJson.put("success", successArr);
|
|
|
returnJson.put("fail", failArr);
|
|
|
return returnJson;
|
|
@@ -473,7 +466,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
if (Check.isNull(campaignId)) {
|
|
|
throw new Exception("请选择广告计划");
|
|
|
}
|
|
|
-
|
|
|
String type = requestJson.getString("type");
|
|
|
if ("copy".equals(type) && !Check.isNull(type)) {
|
|
|
unitJson.put("campaign_id", requestJson.getLong("copyToCampaignId"));
|
|
@@ -848,8 +840,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
// 自定义年龄段
|
|
|
Integer ageMin = groupTarget.getAgeMin();
|
|
|
Integer ageMax = groupTarget.getAgeMax();
|
|
|
-
|
|
|
-
|
|
|
JSONObject ageJson = new JSONObject();
|
|
|
if (!Check.isNull(ageMin)) {
|
|
|
ageJson.put("min", ageMin);
|