|
@@ -1860,39 +1860,29 @@ public class BatchServiceImpl implements IBatchService {
|
|
if (Check.isNull(requestJson)) {
|
|
if (Check.isNull(requestJson)) {
|
|
throw new Exception("入参为空");
|
|
throw new Exception("入参为空");
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
JSONObject creativeJson = new JSONObject();
|
|
JSONObject creativeJson = new JSONObject();
|
|
creativeJson.put("advertiser_id", token.getAccountId());
|
|
creativeJson.put("advertiser_id", token.getAccountId());
|
|
-
|
|
|
|
Long creativeId = requestJson.getLong("creativeId");
|
|
Long creativeId = requestJson.getLong("creativeId");
|
|
if (Check.isNull(creativeId)) {
|
|
if (Check.isNull(creativeId)) {
|
|
throw new Exception("请选择广告创意");
|
|
throw new Exception("请选择广告创意");
|
|
}
|
|
}
|
|
creativeJson.put("creative_id", creativeId);
|
|
creativeJson.put("creative_id", creativeId);
|
|
-
|
|
|
|
-
|
|
|
|
// 创意名称
|
|
// 创意名称
|
|
if (!Check.isNull(requestJson.get("creativeName"))) {
|
|
if (!Check.isNull(requestJson.get("creativeName"))) {
|
|
creativeJson.put("creative_name", requestJson.get("creativeName"));
|
|
creativeJson.put("creative_name", requestJson.get("creativeName"));
|
|
}
|
|
}
|
|
-
|
|
|
|
//封面
|
|
//封面
|
|
if (!Check.isNull(requestJson.get("photoId"))) {
|
|
if (!Check.isNull(requestJson.get("photoId"))) {
|
|
creativeJson.put("photo_id", requestJson.get("photoId"));
|
|
creativeJson.put("photo_id", requestJson.get("photoId"));
|
|
}
|
|
}
|
|
-
|
|
|
|
// 视频id
|
|
// 视频id
|
|
if (!Check.isNull(requestJson.get("imageToken"))) {
|
|
if (!Check.isNull(requestJson.get("imageToken"))) {
|
|
creativeJson.put("image_token", requestJson.get("imageToken"));
|
|
creativeJson.put("image_token", requestJson.get("imageToken"));
|
|
}
|
|
}
|
|
-
|
|
|
|
// 行动号召按钮
|
|
// 行动号召按钮
|
|
if (!Check.isNull(requestJson.get("actionBarText"))) {
|
|
if (!Check.isNull(requestJson.get("actionBarText"))) {
|
|
creativeJson.put("action_bar_text", requestJson.get("actionBarText"));
|
|
creativeJson.put("action_bar_text", requestJson.get("actionBarText"));
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
// 广告语
|
|
// 广告语
|
|
if (!Check.isNull(requestJson.get("description"))) {
|
|
if (!Check.isNull(requestJson.get("description"))) {
|
|
creativeJson.put("description", requestJson.getString("description").trim());
|
|
creativeJson.put("description", requestJson.getString("description").trim());
|
|
@@ -1901,7 +1891,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
if (!Check.isNull(requestJson.get("stickerTitle"))) {
|
|
if (!Check.isNull(requestJson.get("stickerTitle"))) {
|
|
creativeJson.put("sticker_title", requestJson.get("stickerTitle"));
|
|
creativeJson.put("sticker_title", requestJson.get("stickerTitle"));
|
|
}
|
|
}
|
|
-
|
|
|
|
// 贴纸样式
|
|
// 贴纸样式
|
|
if (!Check.isNull(requestJson.get("overlayType"))) {
|
|
if (!Check.isNull(requestJson.get("overlayType"))) {
|
|
creativeJson.put("overlay_type", requestJson.get("overlayType"));
|
|
creativeJson.put("overlay_type", requestJson.get("overlayType"));
|
|
@@ -1910,18 +1899,15 @@ public class BatchServiceImpl implements IBatchService {
|
|
if (!Check.isNull(requestJson.get("clickTrackUrl"))) {
|
|
if (!Check.isNull(requestJson.get("clickTrackUrl"))) {
|
|
creativeJson.put("click_track_url", requestJson.get("clickTrackUrl"));
|
|
creativeJson.put("click_track_url", requestJson.get("clickTrackUrl"));
|
|
}
|
|
}
|
|
-
|
|
|
|
// 后贴片 第三方检测链接
|
|
// 后贴片 第三方检测链接
|
|
if (!Check.isNull(requestJson.get("adPhotoPlayedT3sUrl"))) {
|
|
if (!Check.isNull(requestJson.get("adPhotoPlayedT3sUrl"))) {
|
|
creativeJson.put("ad_photo_played_t3s_url", requestJson.get("adPhotoPlayedT3sUrl"));
|
|
creativeJson.put("ad_photo_played_t3s_url", requestJson.get("adPhotoPlayedT3sUrl"));
|
|
}
|
|
}
|
|
-
|
|
|
|
// 后贴片 第三方检测链接
|
|
// 后贴片 第三方检测链接
|
|
if (!Check.isNull(requestJson.get("impressionUrl"))) {
|
|
if (!Check.isNull(requestJson.get("impressionUrl"))) {
|
|
creativeJson.put("impression_url", requestJson.get("impressionUrl"));
|
|
creativeJson.put("impression_url", requestJson.get("impressionUrl"));
|
|
}
|
|
}
|
|
JSONObject returnJson = updateService.updateCreative(token.getAccessToken(), creativeJson);
|
|
JSONObject returnJson = updateService.updateCreative(token.getAccessToken(), creativeJson);
|
|
-
|
|
|
|
return returnJson;
|
|
return returnJson;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1935,14 +1921,12 @@ public class BatchServiceImpl implements IBatchService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONObject getWhiteList(Long accountId, String accessToken) {
|
|
public JSONObject getWhiteList(Long accountId, String accessToken) {
|
|
-
|
|
|
|
String url = "https://ad.e.kuaishou.com/rest/openapi/v1/advertiser/white_list";
|
|
String url = "https://ad.e.kuaishou.com/rest/openapi/v1/advertiser/white_list";
|
|
Map<String, String> headers = new HashMap<String, String>();
|
|
Map<String, String> headers = new HashMap<String, String>();
|
|
headers.put("Content-Type", "application/json");
|
|
headers.put("Content-Type", "application/json");
|
|
headers.put("Access-Token", accessToken);
|
|
headers.put("Access-Token", accessToken);
|
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
Map<String, Object> param = new HashMap<String, Object>();
|
|
param.put("advertiser_id", accountId);
|
|
param.put("advertiser_id", accountId);
|
|
-
|
|
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
String result = HttpUtils.httpPostRequest(url, param, headers);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
JSONObject resultJson = JSONObject.parseObject(result);
|
|
log.info("获取联盟白名单,accountId:{},data:{}", accountId, resultJson);
|
|
log.info("获取联盟白名单,accountId:{},data:{}", accountId, resultJson);
|
|
@@ -1951,7 +1935,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
if (code == 0) {
|
|
if (code == 0) {
|
|
return resultJson.getJSONObject("data");
|
|
return resultJson.getJSONObject("data");
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
@@ -1997,7 +1980,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public JSONArray getCreativeCategory(Long accountId, String accessToken) {
|
|
public JSONArray getCreativeCategory(Long accountId, String accessToken) {
|
|
-
|
|
|
|
try {
|
|
try {
|
|
String url = "https://ad.e.kuaishou.com/rest/openapi/v1/creative/creative_category/list";
|
|
String url = "https://ad.e.kuaishou.com/rest/openapi/v1/creative/creative_category/list";
|
|
Map<String, String> headers = new HashMap<String, String>();
|
|
Map<String, String> headers = new HashMap<String, String>();
|
|
@@ -2038,7 +2020,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
|
|
|
|
|
|
|
|
private JSONArray getSecond(String categoryId, JSONArray details) {
|
|
private JSONArray getSecond(String categoryId, JSONArray details) {
|
|
-
|
|
|
|
JSONArray secondArr = new JSONArray();
|
|
JSONArray secondArr = new JSONArray();
|
|
for (int i = 0; i < details.size(); i++) {
|
|
for (int i = 0; i < details.size(); i++) {
|
|
JSONObject secondJson = details.getJSONObject(i);
|
|
JSONObject secondJson = details.getJSONObject(i);
|
|
@@ -2060,7 +2041,6 @@ public class BatchServiceImpl implements IBatchService {
|
|
if (categoryId.equals(parent_id)) {
|
|
if (categoryId.equals(parent_id)) {
|
|
thirdArr.add(thirdJson);
|
|
thirdArr.add(thirdJson);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
return thirdArr;
|
|
return thirdArr;
|
|
}
|
|
}
|