|
@@ -170,6 +170,7 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
|
|
data.put("ad_id", adId);
|
|
data.put("ad_id", adId);
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_create_v2");
|
|
String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_creative_create_v2");
|
|
JSONObject result = HttpUtils.bytedancePostRequest(token.getAccessToken(),url,data);
|
|
JSONObject result = HttpUtils.bytedancePostRequest(token.getAccessToken(),url,data);
|
|
|
|
+ System.out.println(result);
|
|
Integer code = result.getInteger("code");
|
|
Integer code = result.getInteger("code");
|
|
String message = result.getString("message");
|
|
String message = result.getString("message");
|
|
if (null == code || code != 0) {
|
|
if (null == code || code != 0) {
|
|
@@ -272,7 +273,7 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
|
|
public Map<String, Object> batchCreate(JSONObject data) {
|
|
public Map<String, Object> batchCreate(JSONObject data) {
|
|
log.info(data.toJSONString());
|
|
log.info(data.toJSONString());
|
|
Map<String,Object>result = new HashMap<>();
|
|
Map<String,Object>result = new HashMap<>();
|
|
- Long accountId = data.getLong("advertiserId");
|
|
|
|
|
|
+ Long accountId = data.getLong("accountId");
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
if(null == token){
|
|
if(null == token){
|
|
ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
|
|
ResultMapUtils.setResultMap(result,StatusCode.COMMON_PARAM_ERROR);
|
|
@@ -285,8 +286,13 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
|
|
}
|
|
}
|
|
//拼接参数
|
|
//拼接参数
|
|
JSONObject params = initParams(data);
|
|
JSONObject params = initParams(data);
|
|
-
|
|
|
|
- return null;
|
|
|
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
|
+ for(int i=0;i<planIds.size();i++){
|
|
|
|
+ Map<String,Object> getData = creativeCreate(accountId+"",planIds.getLong(i),params);
|
|
|
|
+ array.add(getData);
|
|
|
|
+ }
|
|
|
|
+ result.put("data",array);
|
|
|
|
+ return result;
|
|
}
|
|
}
|
|
|
|
|
|
private JSONObject initParams(JSONObject data) {
|
|
private JSONObject initParams(JSONObject data) {
|
|
@@ -294,14 +300,17 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
|
|
String creativeWay = data.getString("creativeWay");
|
|
String creativeWay = data.getString("creativeWay");
|
|
params.put("advertiser_id",data.getLong("accountId"));
|
|
params.put("advertiser_id",data.getLong("accountId"));
|
|
//###############公共参数开始################################
|
|
//###############公共参数开始################################
|
|
- JSONArray inventoryType = data.getJSONArray("inventoryType");
|
|
|
|
- if(null!=inventoryType){
|
|
|
|
- params.put("inventory_type",inventoryType);
|
|
|
|
- }
|
|
|
|
|
|
+ //优选广告位
|
|
Integer smartInventory = data.getInteger("smartInventory");
|
|
Integer smartInventory = data.getInteger("smartInventory");
|
|
if(null!=smartInventory){
|
|
if(null!=smartInventory){
|
|
params.put("smart_inventory",smartInventory);
|
|
params.put("smart_inventory",smartInventory);
|
|
}
|
|
}
|
|
|
|
+ //媒体指定位置
|
|
|
|
+ JSONArray inventoryType = data.getJSONArray("inventoryType");
|
|
|
|
+ if(null!=inventoryType){
|
|
|
|
+ params.put("inventory_type",inventoryType);
|
|
|
|
+ }
|
|
|
|
+ //场景指定位置
|
|
String sceneInventory = data.getString("sceneInventory");
|
|
String sceneInventory = data.getString("sceneInventory");
|
|
if(null!=sceneInventory&&!sceneInventory.trim().equals("")){
|
|
if(null!=sceneInventory&&!sceneInventory.trim().equals("")){
|
|
params.put("scene_inventory",sceneInventory);
|
|
params.put("scene_inventory",sceneInventory);
|
|
@@ -315,6 +324,9 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
|
|
params.put("third_industry_id",thirdIndustryId);
|
|
params.put("third_industry_id",thirdIndustryId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 创意展现方式
|
|
|
|
+ */
|
|
String creativeDisplayMode = data.getString("creativeDisplayMode");
|
|
String creativeDisplayMode = data.getString("creativeDisplayMode");
|
|
if(null!=creativeDisplayMode&&creativeDisplayMode.trim().equals("")){
|
|
if(null!=creativeDisplayMode&&creativeDisplayMode.trim().equals("")){
|
|
params.put("creative_display_mode",creativeDisplayMode);
|
|
params.put("creative_display_mode",creativeDisplayMode);
|
|
@@ -351,12 +363,12 @@ public class ByteDanceCreativeServiceImpl extends ServiceImpl<ByteDanceCreativeM
|
|
if(null!=generateDerivedAd&&generateDerivedAd!=0){
|
|
if(null!=generateDerivedAd&&generateDerivedAd!=0){
|
|
params.put("generate_derived_ad",generateDerivedAd);
|
|
params.put("generate_derived_ad",generateDerivedAd);
|
|
}
|
|
}
|
|
- String playableUrl = data.getString("playable_url");
|
|
|
|
|
|
+ String playableUrl = data.getString("playableUrl");
|
|
if(null!=playableUrl&&!"".equals(playableUrl.trim())){
|
|
if(null!=playableUrl&&!"".equals(playableUrl.trim())){
|
|
params.put("playable_url",playableUrl);
|
|
params.put("playable_url",playableUrl);
|
|
}
|
|
}
|
|
Long isPresentedVideo = data.getLong("isPresentedVideo");
|
|
Long isPresentedVideo = data.getLong("isPresentedVideo");
|
|
- if(null!=isCommentDisable&&isPresentedVideo!=0){
|
|
|
|
|
|
+ if(null!=isPresentedVideo&&isPresentedVideo!=0){
|
|
params.put("is_presented_video",isPresentedVideo);
|
|
params.put("is_presented_video",isPresentedVideo);
|
|
}
|
|
}
|
|
Long creativeAutoGenerateSwitch = data.getLong("creativeAutoGenerateSwitch");
|
|
Long creativeAutoGenerateSwitch = data.getLong("creativeAutoGenerateSwitch");
|