|
@@ -51,6 +51,27 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
|
|
|
if (Check.isNull(template)) {
|
|
|
throw new Exception("未匹配到模板信息");
|
|
|
}
|
|
|
+
|
|
|
+ // 投放时段前端传值问题,需要单独处理
|
|
|
+ String schedule = template.getSchedule();
|
|
|
+ JSONArray scheduleArray = new JSONArray();
|
|
|
+ if (!Check.isNull(schedule)) {
|
|
|
+ JSONArray array = JSONArray.parseArray(schedule);
|
|
|
+ if (!Check.isNull(array)) {
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ JSONArray jsonArray = array.getJSONArray(i);
|
|
|
+ JSONArray addArray = new JSONArray();
|
|
|
+ for (int j = 0; j < jsonArray.size(); j++) {
|
|
|
+ Integer value = jsonArray.getInteger(j);
|
|
|
+ if (Check.isNull(value)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ addArray.add(value);
|
|
|
+ }
|
|
|
+ scheduleArray.add(addArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
List<List<Object>> videoList = Lists.partition(videoArray, template.getVideoCount());
|
|
|
List<KuaishouHostingTask> addList = new ArrayList<>();
|
|
|
for (int i = 0; i < videoList.size(); i++) {
|
|
@@ -88,7 +109,7 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
|
|
|
task.setClickUrl(template.getClickUrl());
|
|
|
task.setActionbarClickUrl(template.getActionbarClickUrl());
|
|
|
task.setAutoCreatePhoto(template.getAutoCreatePhoto());
|
|
|
- task.setSchedule(template.getSchedule());
|
|
|
+ task.setSchedule(scheduleArray.toJSONString());
|
|
|
task.setDayBudget(template.getDayBudget());
|
|
|
task.setOcpxActionType(template.getOcpxActionType());
|
|
|
task.setCpaBid(template.getCpaBid());
|
|
@@ -198,16 +219,21 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
|
|
|
if (!Check.isNull(task.getActionbarClickUrl())) {
|
|
|
requestJson.put("actionbar_click_url", task.getActionbarClickUrl());
|
|
|
}
|
|
|
- if (task.getAutoCreatePhoto() == 1) {
|
|
|
- requestJson.put("auto_create_photo", true);
|
|
|
+ if (!Check.isNull(task.getAutoCreatePhoto())) {
|
|
|
+ if (task.getAutoCreatePhoto() == 1) {
|
|
|
+ requestJson.put("auto_create_photo", true);
|
|
|
+ } else {
|
|
|
+ requestJson.put("auto_create_photo", false);
|
|
|
+ }
|
|
|
} else {
|
|
|
requestJson.put("auto_create_photo", false);
|
|
|
}
|
|
|
+
|
|
|
Long begin_time = System.currentTimeMillis();
|
|
|
requestJson.put("begin_time", begin_time);
|
|
|
requestJson.put("end_time", 0);
|
|
|
if (!Check.isNull(task.getSchedule())) {
|
|
|
- requestJson.put("schedule", JSONArray.parseArray(task.getSchedule()));
|
|
|
+ requestJson.put("schedule", task.getSchedule());
|
|
|
}
|
|
|
requestJson.put("day_budget", task.getDayBudget());
|
|
|
requestJson.put("ocpx_action_type", task.getOcpxActionType());
|
|
@@ -272,10 +298,18 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
|
|
|
Integer maxAge = task.getMaxAge();
|
|
|
JSONArray ageArray = new JSONArray();
|
|
|
if (!Check.isNull(minAge) && !Check.isNull(maxAge)) {
|
|
|
- JSONObject ageJson = new JSONObject();
|
|
|
- ageJson.put("min", minAge);
|
|
|
- ageJson.put("max", maxAge);
|
|
|
- ageArray.add(ageJson);
|
|
|
+ if (maxAge != -1 && minAge != -1) {
|
|
|
+ JSONObject ageJson = new JSONObject();
|
|
|
+ ageJson.put("min", minAge);
|
|
|
+ ageJson.put("max", maxAge);
|
|
|
+ ageArray.add(ageJson);
|
|
|
+ } else {
|
|
|
+ String agesRange = task.getAgesRange();
|
|
|
+ JSONArray agesRangeArray = JSONArray.parseArray(agesRange);
|
|
|
+ if (!Check.isNull(agesRangeArray)) {
|
|
|
+ ageArray = getAgeArray(agesRangeArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
String agesRange = task.getAgesRange();
|
|
|
JSONArray agesRangeArray = JSONArray.parseArray(agesRange);
|
|
@@ -360,7 +394,7 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
|
|
|
}
|
|
|
hostingTaskMapper.updateInfoById(task.getId(), projectId, campaignId, 3, "创建成功");
|
|
|
} else {
|
|
|
- log.error("智能托管创建失败,accountId:{},入参:{}。返回:{}", task.getAccountId(), requestJson, hosting);
|
|
|
+ log.error("智能托管创建失败,accountId:{},入参:{},返回:{}", task.getAccountId(), requestJson, hosting);
|
|
|
hostingTaskMapper.updateStatusById(task.getId(), 3, hosting.getString("message"));
|
|
|
}
|
|
|
}
|