|
@@ -1072,7 +1072,13 @@ public class BatchServiceImpl implements IBatchService {
|
|
creativeJson.put("action_bar_text", action_bar_text);
|
|
creativeJson.put("action_bar_text", action_bar_text);
|
|
creativeJson.put("description", description.trim());
|
|
creativeJson.put("description", description.trim());
|
|
creativeJson.put("creative_name", name);
|
|
creativeJson.put("creative_name", name);
|
|
- // creativeJson.put("click_track_url", click_track_url);
|
|
|
|
|
|
+ String imageToken = null;
|
|
|
|
+ if (!Check.isNull(creative.getStickerTitle()) && !Check.isNull(creative.getOverlayType())) {
|
|
|
|
+ imageToken = creative.getOverlayBgImageToken();
|
|
|
|
+ } else {
|
|
|
|
+ imageToken = creative.getImageToken();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
//封面广告语标题
|
|
//封面广告语标题
|
|
if (!Check.isNull(creative.getStickerTitle())) {
|
|
if (!Check.isNull(creative.getStickerTitle())) {
|
|
@@ -1083,6 +1089,7 @@ public class BatchServiceImpl implements IBatchService {
|
|
creativeJson.put("overlay_type", creative.getOverlayType());
|
|
creativeJson.put("overlay_type", creative.getOverlayType());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
// 第三方有效播放监测链接
|
|
// 第三方有效播放监测链接
|
|
if (!Check.isNull(creative.getAdPhotoPlayedT3sUrl())) {
|
|
if (!Check.isNull(creative.getAdPhotoPlayedT3sUrl())) {
|
|
creativeJson.put("ad_photo_played_t3s_url", creative.getAdPhotoPlayedT3sUrl());
|
|
creativeJson.put("ad_photo_played_t3s_url", creative.getAdPhotoPlayedT3sUrl());
|
|
@@ -1092,7 +1099,13 @@ public class BatchServiceImpl implements IBatchService {
|
|
creativeJson.put("actionbar_click_url", creative.getActionbarClickUrl());
|
|
creativeJson.put("actionbar_click_url", creative.getActionbarClickUrl());
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创意标签
|
|
|
|
+ */
|
|
|
|
+ if (!Check.isNull(creative.getCreativeCategory()) && !Check.isNull(!Check.isNull(creative.getCreativeTag()))) {
|
|
|
|
+ creativeJson.put("creative_category", creative.getCreativeCategory());
|
|
|
|
+ creativeJson.put("creative_tag", JSONArray.parseArray(creative.getCreativeTag()));
|
|
|
|
+ }
|
|
if (!Check.isNull(otherJson)) {
|
|
if (!Check.isNull(otherJson)) {
|
|
Boolean isUpdate = otherJson.getBoolean("isUpdate"); // 是否修改落地页
|
|
Boolean isUpdate = otherJson.getBoolean("isUpdate"); // 是否修改落地页
|
|
if (isUpdate) {
|
|
if (isUpdate) {
|
|
@@ -1117,8 +1130,7 @@ public class BatchServiceImpl implements IBatchService {
|
|
} else {
|
|
} else {
|
|
String photo_id = creative.getPhotoId();
|
|
String photo_id = creative.getPhotoId();
|
|
creativeJson.put("photo_id", photo_id);
|
|
creativeJson.put("photo_id", photo_id);
|
|
- String image = creative.getImageToken();
|
|
|
|
- creativeJson.put("image_token", image);
|
|
|
|
|
|
+ creativeJson.put("image_token", imageToken);
|
|
creativeJson.put("click_track_url", clickTrackUrl);
|
|
creativeJson.put("click_track_url", clickTrackUrl);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1137,8 +1149,7 @@ public class BatchServiceImpl implements IBatchService {
|
|
} else {
|
|
} else {
|
|
String photo_id = creative.getPhotoId();
|
|
String photo_id = creative.getPhotoId();
|
|
creativeJson.put("photo_id", photo_id);
|
|
creativeJson.put("photo_id", photo_id);
|
|
- String image = creative.getImageToken();
|
|
|
|
- creativeJson.put("image_token", image);
|
|
|
|
|
|
+ creativeJson.put("image_token", imageToken);
|
|
if (!Check.isNull(click_track_url)) {
|
|
if (!Check.isNull(click_track_url)) {
|
|
creativeJson.put("click_track_url", click_track_url);
|
|
creativeJson.put("click_track_url", click_track_url);
|
|
}
|
|
}
|
|
@@ -1159,8 +1170,8 @@ public class BatchServiceImpl implements IBatchService {
|
|
} else {
|
|
} else {
|
|
String photo_id = creative.getPhotoId();
|
|
String photo_id = creative.getPhotoId();
|
|
creativeJson.put("photo_id", photo_id);
|
|
creativeJson.put("photo_id", photo_id);
|
|
- String image = creative.getImageToken();
|
|
|
|
- creativeJson.put("image_token", image);
|
|
|
|
|
|
+ creativeJson.put("image_token", imageToken);
|
|
|
|
+
|
|
if (!Check.isNull(click_track_url)) {
|
|
if (!Check.isNull(click_track_url)) {
|
|
creativeJson.put("click_track_url", click_track_url);
|
|
creativeJson.put("click_track_url", click_track_url);
|
|
}
|
|
}
|
|
@@ -1186,8 +1197,7 @@ public class BatchServiceImpl implements IBatchService {
|
|
} else {
|
|
} else {
|
|
String photo_id = creative.getPhotoId();
|
|
String photo_id = creative.getPhotoId();
|
|
creativeJson.put("photo_id", photo_id);
|
|
creativeJson.put("photo_id", photo_id);
|
|
- String image = creative.getImageToken();
|
|
|
|
- creativeJson.put("image_token", image);
|
|
|
|
|
|
+ creativeJson.put("image_token", imageToken);
|
|
if (!Check.isNull(click_track_url)) {
|
|
if (!Check.isNull(click_track_url)) {
|
|
creativeJson.put("click_track_url", click_track_url);
|
|
creativeJson.put("click_track_url", click_track_url);
|
|
}
|
|
}
|
|
@@ -1272,6 +1282,9 @@ public class BatchServiceImpl implements IBatchService {
|
|
String action_bar_text = requestJson.getString("actionBarText");
|
|
String action_bar_text = requestJson.getString("actionBarText");
|
|
String click_track_url = requestJson.getString("clickTrackUrl");
|
|
String click_track_url = requestJson.getString("clickTrackUrl");
|
|
String site_id = requestJson.getString("siteId");
|
|
String site_id = requestJson.getString("siteId");
|
|
|
|
+ Integer creativeCategory = requestJson.getInteger("creativeCategory");// 创意分类
|
|
|
|
+ JSONArray creativeTag = requestJson.getJSONArray("creativeTag");
|
|
|
|
+
|
|
JSONObject returnJson = new JSONObject();
|
|
JSONObject returnJson = new JSONObject();
|
|
JSONArray successArr = new JSONArray();
|
|
JSONArray successArr = new JSONArray();
|
|
JSONArray failArr = new JSONArray();
|
|
JSONArray failArr = new JSONArray();
|
|
@@ -1285,8 +1298,8 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
|
|
|
String creativeMaterialType = dataJson.getString("creativeMaterialType");
|
|
String creativeMaterialType = dataJson.getString("creativeMaterialType");
|
|
String shortSlogan = dataJson.getString("shortSlogan");
|
|
String shortSlogan = dataJson.getString("shortSlogan");
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ String overlayType = dataJson.getString("overlayType");
|
|
|
|
+ String stickerTitle = dataJson.getString("stickerTitle");
|
|
if (!Check.isNull(dataJsons)) {
|
|
if (!Check.isNull(dataJsons)) {
|
|
String description = dataJson.getString("description");
|
|
String description = dataJson.getString("description");
|
|
String photo_id = dataJson.getString("photoId");
|
|
String photo_id = dataJson.getString("photoId");
|
|
@@ -1309,11 +1322,22 @@ public class BatchServiceImpl implements IBatchService {
|
|
creativeJson.put("creative_material_type", creativeMaterialType);
|
|
creativeJson.put("creative_material_type", creativeMaterialType);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!Check.isNull(overlayType)) {
|
|
|
|
+ creativeJson.put("overlay_type", overlayType);
|
|
|
|
+ }
|
|
|
|
+ if (!Check.isNull(stickerTitle)) {
|
|
|
|
+ creativeJson.put("sticker_title", stickerTitle);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!Check.isNull(creativeCategory) && !Check.isNull(creativeTag)) {
|
|
|
|
+ creativeJson.put("creative_category", creativeCategory);
|
|
|
|
+ creativeJson.put("creative_tag", creativeTag);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (creativeMaterialType.equals("4")) {
|
|
if (creativeMaterialType.equals("4")) {
|
|
if (!Check.isNull("shortSlogan")) {
|
|
if (!Check.isNull("shortSlogan")) {
|
|
creativeJson.put("short_slogan", shortSlogan);
|
|
creativeJson.put("short_slogan", shortSlogan);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
String imageToken = null;
|
|
String imageToken = null;
|
|
String signature = imageJson.getString("signature");
|
|
String signature = imageJson.getString("signature");
|
|
@@ -1789,27 +1813,97 @@ public class BatchServiceImpl implements IBatchService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONArray getCreativeWordStyles(Long accountId, String accessToken) {
|
|
public JSONArray getCreativeWordStyles(Long accountId, String accessToken) {
|
|
- String url = "https://ad.e.kuaishou.com/rest/openapi/v1/tool/creative_word/styles";
|
|
|
|
- Map<String, String> headers = new HashMap<String, String>();
|
|
|
|
- headers.put("Content-Type", "application/json");
|
|
|
|
- headers.put("Access-Token", accessToken);
|
|
|
|
- Map<String, Object> param = new HashMap<String, Object>();
|
|
|
|
- param.put("advertiser_id", accountId);
|
|
|
|
-
|
|
|
|
- String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
|
- JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
|
- log.info("获取贴纸样式,accountId:{},data:{}", accountId, resultJson);
|
|
|
|
- if (!Check.isNull(resultJson)) {
|
|
|
|
- Integer code = resultJson.getInteger("code");
|
|
|
|
- if (code == 0) {
|
|
|
|
- return resultJson.getJSONArray("data");
|
|
|
|
|
|
+ try {
|
|
|
|
+ String url = "https://ad.e.kuaishou.com/rest/openapi/v1/tool/creative_word/styles";
|
|
|
|
+ Map<String, String> headers = new HashMap<String, String>();
|
|
|
|
+ headers.put("Content-Type", "application/json");
|
|
|
|
+ headers.put("Access-Token", accessToken);
|
|
|
|
+ Map<String, Object> param = new HashMap<String, Object>();
|
|
|
|
+ param.put("advertiser_id", accountId);
|
|
|
|
+ String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
|
+ if (!Check.isNull(resultJson)) {
|
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ return resultJson.getJSONArray("data");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取创意分类
|
|
|
|
+ *
|
|
|
|
+ * @param accountId
|
|
|
|
+ * @param accessToken
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public JSONArray getCreativeCategory(Long accountId, String accessToken) {
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ String url = "https://ad.e.kuaishou.com/rest/openapi/v1/creative/creative_category/list";
|
|
|
|
+ Map<String, String> headers = new HashMap<String, String>();
|
|
|
|
+ headers.put("Content-Type", "application/json");
|
|
|
|
+ headers.put("Access-Token", accessToken);
|
|
|
|
+ Map<String, Object> param = new HashMap<String, Object>();
|
|
|
|
+ param.put("advertiser_id", accountId);
|
|
|
|
+ String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
|
|
+ JSONObject resultJson = JSONObject.parseObject(result);
|
|
|
|
+ if (!Check.isNull(resultJson)) {
|
|
|
|
+ Integer code = resultJson.getInteger("code");
|
|
|
|
+ if (code == 0) {
|
|
|
|
+ JSONObject data = resultJson.getJSONObject("data");
|
|
|
|
+ if (!Check.isNull(data)) {
|
|
|
|
+ JSONArray details = data.getJSONArray("details");
|
|
|
|
+ if (!Check.isNull(details)) {
|
|
|
|
+ JSONArray returnArr = new JSONArray();
|
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
|
+ JSONObject jsonObject = details.getJSONObject(i);
|
|
|
|
+
|
|
|
|
+ String level = jsonObject.getString("level");
|
|
|
|
+ if ("1".equals(level)) {
|
|
|
|
+ JSONArray LevelArr = getSubLevel(jsonObject.getInteger("category_id"), details);
|
|
|
|
+ jsonObject.put("child", LevelArr);
|
|
|
|
+ returnArr.add(jsonObject);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return returnArr;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ private JSONArray getSubLevel(Integer categoryId, JSONArray details) {
|
|
|
|
+
|
|
|
|
+ JSONArray secondArr = new JSONArray();
|
|
|
|
+ for (int i = 0; i < details.size(); i++) {
|
|
|
|
+ JSONObject secondJson = details.getJSONObject(i);
|
|
|
|
+ if ("2".equals(secondJson.getString("level")) && categoryId.equals(secondJson.getInteger("parent_id"))) {
|
|
|
|
+ JSONArray thirdArr = new JSONArray();
|
|
|
|
+ for (int j = 0; j < details.size(); j++) {
|
|
|
|
+ JSONObject thirdJson = details.getJSONObject(j);
|
|
|
|
+ if ("3".equals(thirdJson.getString("level")) && secondJson.getInteger("category_id").equals(thirdJson.getInteger("parent_id"))) {
|
|
|
|
+ thirdArr.add(thirdJson);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ secondJson.put("child", thirdArr);
|
|
|
|
+ secondArr.add(secondJson);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return secondArr;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|