|
@@ -158,6 +158,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
JSONObject creativeParams = getCreativeParams(strategy,adId,video,token);
|
|
|
log.info("账户id:{};创意创建参数:{}",strategy.getAccountId(),creativeParams);
|
|
|
JSONObject creativeObject = marketingService.creativeCreate(token,adId,creativeParams);
|
|
|
+ log.info("创建创意=====》》》》》》{}",creativeObject);
|
|
|
if(null!=creativeObject.getInteger("code")&&creativeObject.getInteger("code")!=0){
|
|
|
List<Long> adIds = new ArrayList<>();
|
|
|
adIds.add(adId);
|
|
@@ -272,69 +273,105 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
return videoCnt;
|
|
|
}
|
|
|
+
|
|
|
+ // 创建创意 拼接创意参数
|
|
|
private JSONObject getCreativeParams(AiBytedanceAdvertiserStrategy strategy, Long adId,ByteDanceVideoInfo videoInfo,CtopOauthToken token) {
|
|
|
JSONObject params = new JSONObject();
|
|
|
params.put("advertiser_id", strategy.getAccountId());
|
|
|
params.put("ad_id", adId);
|
|
|
- String inventoryType = strategy.getCreativeInventoryType();
|
|
|
- if ("CREATIVE_IMAGE_MODE_UNION_SPLASH".equalsIgnoreCase(strategy.getCreativeImageMode())) {
|
|
|
- params.put("inventory_type", new String[]{"INVENTORY_UNION_SPLASH_SLOT"});
|
|
|
- } else {
|
|
|
- if (null != inventoryType && !"".equals(inventoryType)) {
|
|
|
- String[] inventoryTypeString = inventoryType.split(",");
|
|
|
- if (inventoryTypeString.length > 0) {
|
|
|
- params.put("inventory_type", inventoryTypeString);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
- Integer smartInventory = strategy.getCreativeSmartInventory();
|
|
|
- if(null!=smartInventory&&smartInventory!=0){
|
|
|
- params.put("smart_inventory",smartInventory);
|
|
|
+ /*基础创意*/
|
|
|
+ JSONObject ad_data = new JSONObject();
|
|
|
+ //行业类别
|
|
|
+ String thirdIndustryId = strategy.getCreativeThirdIndustryId();
|
|
|
+ if(!Check.isNull(thirdIndustryId)){
|
|
|
+ ad_data.put("third_industry_id",thirdIndustryId);
|
|
|
}
|
|
|
|
|
|
- String sceneInventory = strategy.getCreativeSceneInventory();
|
|
|
- if(!Check.isNull(sceneInventory)){
|
|
|
- params.put("scene_inventory",sceneInventory);
|
|
|
+ //关键词 添加随机关键词逻辑
|
|
|
+ String adKeywords = strategy.getCreativeAdKeywords();
|
|
|
+ if(!Check.isNull(adKeywords)){
|
|
|
+ String [] keywords = adKeywords.split(",");
|
|
|
+ if(keywords.length>0){
|
|
|
+ if(keywords.length<=20){
|
|
|
+ ad_data.put("ad_keywords",keywords);
|
|
|
+ }else {
|
|
|
+ List<String>keywordList = Arrays.asList(keywords);
|
|
|
+ Collections.shuffle(keywordList);
|
|
|
+ List<String> getKeyWords = keywordList.subList(0,20);
|
|
|
+ ad_data.put("ad_keywords",getKeyWords);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //广告来源
|
|
|
+ String source = strategy.getCreativeSource();
|
|
|
+ if(!Check.isNull(source)){
|
|
|
+ ad_data.put("source",source);
|
|
|
+ }
|
|
|
+ //推广抖音号
|
|
|
+ String iesCoreUserId = strategy.getCreativeIesCoreUserId();
|
|
|
+ if(!Check.isNull(iesCoreUserId)){
|
|
|
+ ad_data.put("ies_core_user_id",iesCoreUserId);
|
|
|
+ }
|
|
|
+ //主页作品列表隐藏广告内容
|
|
|
+ Integer isFeedAndFavSee = strategy.getCreativeIsFeedAndFavSee();
|
|
|
+ if(null!=isFeedAndFavSee&&isFeedAndFavSee!=0){
|
|
|
+ ad_data.put("is_feed_and_fav_see",isFeedAndFavSee);
|
|
|
+ }
|
|
|
+ //是否开启自动生成素材
|
|
|
+ Integer creativeAutoGenerateSwitch = strategy.getCreativeAutoGenerateSwitch();
|
|
|
+ if(null!=creativeAutoGenerateSwitch&&creativeAutoGenerateSwitch!=1){
|
|
|
+ ad_data.put("creative_auto_generate_switch",creativeAutoGenerateSwitch);
|
|
|
}
|
|
|
- //程序化创意 非dpa
|
|
|
- params.put("creative_material_mode","STATIC_ASSEMBLE");
|
|
|
//是否自动生成视频素材
|
|
|
Integer isPresentedVideo = strategy.getCreativeIsPresentedVideo();
|
|
|
if(null!=isPresentedVideo&&isPresentedVideo!=0){
|
|
|
- params.put("is_presented_video",isPresentedVideo);
|
|
|
+ ad_data.put("is_presented_video",isPresentedVideo);
|
|
|
}
|
|
|
//是否开启衍生计划
|
|
|
Integer generateDerivedAd = strategy.getCreativeGenerateDerivedAd();
|
|
|
if(null!=generateDerivedAd&&generateDerivedAd!=0){
|
|
|
- params.put("generate_derived_ad",generateDerivedAd);
|
|
|
+ ad_data.put("generate_derived_ad",generateDerivedAd);
|
|
|
+ }
|
|
|
+ //搭配试玩素材url
|
|
|
+ String playableUrl = strategy.getCreativePlayableUrl();
|
|
|
+ if(!Check.isNull(playableUrl)){
|
|
|
+ ad_data.put("playable_url",playableUrl);
|
|
|
+ }
|
|
|
+ //应用名
|
|
|
+ String appName = strategy.getCreativeAppName();
|
|
|
+ if(!Check.isNull(appName)){
|
|
|
+ ad_data.put("app_name",appName);
|
|
|
+ }
|
|
|
+ //Android应用下载详情页
|
|
|
+ String webUrl = strategy.getCreativeWebUrl();
|
|
|
+ if(!Check.isNull(webUrl)){
|
|
|
+ ad_data.put("web_url",webUrl);
|
|
|
+ }
|
|
|
+ //落地页链接
|
|
|
+ if(!Check.isNull(strategy.getAdExternalUrl())){
|
|
|
+ ad_data.put("external_url",strategy.getAdExternalUrl());
|
|
|
}
|
|
|
- //视频素材
|
|
|
- JSONArray imageArray = new JSONArray();
|
|
|
- JSONObject imageObject = new JSONObject();
|
|
|
|
|
|
- if ("video".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
- //视频类型
|
|
|
- //1-竖版视频 2-横版视频
|
|
|
-// String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL" : "CREATIVE_IMAGE_MODE_VIDEO";
|
|
|
- String imageMode = strategy.getCreativeImageMode();
|
|
|
- imageObject.put("image_mode",imageMode);
|
|
|
- imageObject.put("video_id",videoInfo.getVid());
|
|
|
- //获取视频封面id
|
|
|
- String imageId = getSuggestImageId(token,videoInfo.getVid());
|
|
|
- if(!Check.isNull(imageId)){
|
|
|
- imageObject.put("image_id",imageId);
|
|
|
- }
|
|
|
- }else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
- //1-大图横图; 2-大图竖图
|
|
|
-// String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_LARGE" : "CREATIVE_IMAGE_MODE_LARGE_VERTICAL";
|
|
|
- String imageMode = strategy.getCreativeImageMode();
|
|
|
- imageObject.put("image_mode",imageMode);
|
|
|
- imageObject.put("image_ids",new String[]{videoInfo.getId()});
|
|
|
+ //是否关闭评论,0为开启,1为关闭,默认值:0
|
|
|
+ Integer isCommentDisable = strategy.getCreativeIsCommentDisable();
|
|
|
+ if(!Check.isNull(isCommentDisable)&&isCommentDisable!=0){
|
|
|
+ ad_data.put("is_comment_disable",isCommentDisable);
|
|
|
+ }
|
|
|
+ //允许客户端下载视频功能
|
|
|
+ Integer adDownloadStatus = strategy.getCreativeDownloadStatus();
|
|
|
+ if(!Check.isNull(adDownloadStatus)&&adDownloadStatus!=0){
|
|
|
+ ad_data.put("ad_download_status",adDownloadStatus);
|
|
|
+ }
|
|
|
+ //创意展现方式
|
|
|
+ String creativeDisplayMode = strategy.getCreativeDisplayMode();
|
|
|
+ if(!Check.isNull(creativeDisplayMode)){
|
|
|
+ ad_data.put("creative_display_mode",creativeDisplayMode);
|
|
|
}
|
|
|
+ params.put("ad_data",ad_data);
|
|
|
+
|
|
|
+ JSONObject creObj = new JSONObject();
|
|
|
|
|
|
- imageArray.add(imageObject);
|
|
|
- params.put("image_list",imageArray);
|
|
|
JSONArray titleArray = new JSONArray();
|
|
|
List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
|
|
|
//使用指定文案
|
|
@@ -346,11 +383,16 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
JSONObject titleObject = new JSONObject();
|
|
|
titleObject.put("title",slogenInfo.getSlogan());
|
|
|
String creativeWordsIds = slogenInfo.getCreativeWordIds();
|
|
|
+ JSONArray wordsArr = new JSONArray();
|
|
|
if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
- if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
- titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
- }
|
|
|
+ for (Object creative : creativeWordsArray) {
|
|
|
+ JSONObject creativeObject = new JSONObject();
|
|
|
+ creativeObject.put("word_id",creative);
|
|
|
+ wordsArr.add(creativeObject);
|
|
|
+ }
|
|
|
+ titleObject.put("word_list",wordsArr);
|
|
|
+
|
|
|
}
|
|
|
titleArray.add(titleObject);
|
|
|
}
|
|
@@ -366,15 +408,24 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
JSONObject titleObject = new JSONObject();
|
|
|
titleObject.put("title",byteDanceGeneralCopywriter.get(i).getTextCopywriter());
|
|
|
+
|
|
|
String creativeWordsIds = byteDanceGeneralCopywriter.get(i).getCreativeWordIds();
|
|
|
- if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
+
|
|
|
+ JSONArray wordsArr = new JSONArray();
|
|
|
+
|
|
|
+ if(null != creativeWordsIds && !creativeWordsIds.trim().equals("")){
|
|
|
JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
- if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
- titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
- }
|
|
|
+ for (Object creative : creativeWordsArray) {
|
|
|
+ JSONObject creativeObject = new JSONObject();
|
|
|
+ creativeObject.put("word_id",creative);
|
|
|
+ wordsArr.add(creativeObject);
|
|
|
+ }
|
|
|
+ titleObject.put("word_list",wordsArr);
|
|
|
+
|
|
|
}
|
|
|
titleArray.add(titleObject);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
// 图片 使用通用文案 最多10条
|
|
|
}else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
@@ -386,155 +437,90 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
|
|
|
if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
+ JSONArray wordsArr = new JSONArray();
|
|
|
if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
- titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
+ for (Object creative : creativeWordsArray) {
|
|
|
+ JSONObject creativeObject = new JSONObject();
|
|
|
+ creativeObject.put("word_id",creative);
|
|
|
+ wordsArr.add(creativeObject);
|
|
|
+ }
|
|
|
+ titleObject.put("word_list",wordsArr);
|
|
|
}
|
|
|
}
|
|
|
titleArray.add(titleObject);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if(!Check.isNull(titleArray)){
|
|
|
- params.put("title_list",titleArray);
|
|
|
- }
|
|
|
- //广告来源
|
|
|
- String source = strategy.getCreativeSource();
|
|
|
- if(!Check.isNull(source)){
|
|
|
- params.put("source",source);
|
|
|
- }
|
|
|
- //推广抖音号
|
|
|
- String iesCoreUserId = strategy.getCreativeIesCoreUserId();
|
|
|
- if(!Check.isNull(iesCoreUserId)){
|
|
|
- params.put("ies_core_user_id",iesCoreUserId);
|
|
|
- }
|
|
|
- //主页作品列表隐藏广告内容
|
|
|
- Integer isFeedAndFavSee = strategy.getCreativeIsFeedAndFavSee();
|
|
|
- if(null!=isFeedAndFavSee&&isFeedAndFavSee!=0){
|
|
|
- params.put("is_feed_and_fav_see",isFeedAndFavSee);
|
|
|
- }
|
|
|
- //是否开启自动生成素材
|
|
|
- Integer creativeAutoGenerateSwitch = strategy.getCreativeAutoGenerateSwitch();
|
|
|
- if(null!=creativeAutoGenerateSwitch&&creativeAutoGenerateSwitch!=1){
|
|
|
- params.put("creative_auto_generate_switch",creativeAutoGenerateSwitch);
|
|
|
- }
|
|
|
- String appName = strategy.getCreativeAppName();
|
|
|
- if(!Check.isNull(appName)){
|
|
|
- params.put("app_name",appName);
|
|
|
+ creObj.put("title_materials",titleArray);
|
|
|
+ }
|
|
|
+ JSONArray imageMaterials = new JSONArray();
|
|
|
+ JSONObject object = new JSONObject();
|
|
|
+ //类型
|
|
|
+
|
|
|
+ if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
+ //图片素材
|
|
|
+ object.put("image_mode",strategy.getCreativeImageMode());
|
|
|
+ String[] imageIds = new String[]{videoInfo.getId()};
|
|
|
+ JSONArray image_info = new JSONArray();
|
|
|
+ for (String imgId : imageIds) {
|
|
|
+ JSONObject imageObject = new JSONObject();
|
|
|
+ imageObject.put("image_id",imgId);
|
|
|
+ image_info.add(imageObject);
|
|
|
+ }
|
|
|
+ object.put("image_info",image_info);
|
|
|
+ imageMaterials.add(object);
|
|
|
+ creObj.put("image_materials",imageMaterials);
|
|
|
}
|
|
|
|
|
|
- String subTitle = strategy.getCreativeSubTitle();
|
|
|
- if(!Check.isNull(subTitle)){
|
|
|
- params.put("sub_title",subTitle);
|
|
|
- }
|
|
|
+ if ("video".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
+ //视频
|
|
|
+ object.put("image_mode",strategy.getCreativeImageMode());
|
|
|
+ JSONObject videoObj = new JSONObject();
|
|
|
+ videoObj.put("video_id",videoInfo.getVid());
|
|
|
+ //视频封面
|
|
|
+ JSONObject imgObj = new JSONObject();
|
|
|
+ //获取视频封面id
|
|
|
+ String imageId = getSuggestImageId(token,videoInfo.getVid());
|
|
|
+ if(!Check.isNull(imageId)){
|
|
|
+ imgObj.put("image_id",imageId);
|
|
|
+ }
|
|
|
+ object.put("image_info",imgObj);
|
|
|
+ object.put("video_info",videoObj);
|
|
|
|
|
|
- String webUrl = strategy.getCreativeWebUrl();
|
|
|
- if(!Check.isNull(webUrl)){
|
|
|
- params.put("web_url",webUrl);
|
|
|
- }
|
|
|
+ imageMaterials.add(object);
|
|
|
|
|
|
- String actionText = strategy.getCreativeActionText();
|
|
|
- if(!Check.isNull(actionText)){
|
|
|
- params.put("action_text",actionText);
|
|
|
+ creObj.put("video_materials",imageMaterials);
|
|
|
}
|
|
|
|
|
|
- //搭配试玩素材url
|
|
|
- String playableUrl = strategy.getCreativePlayableUrl();
|
|
|
- if(!Check.isNull(playableUrl)){
|
|
|
- params.put("playable_url",playableUrl);
|
|
|
- }
|
|
|
+ //副标题
|
|
|
+ String subTitle = strategy.getCreativeSubTitle();
|
|
|
+ if(!Check.isNull(subTitle)){
|
|
|
+ JSONObject titleObj = new JSONObject();
|
|
|
+ titleObj.put("sub_title",subTitle);
|
|
|
+ creObj.put("sub_title_material",titleObj);
|
|
|
+ }
|
|
|
+ //组件id
|
|
|
+ JSONArray component = new JSONArray();
|
|
|
+ String componentIdStr = strategy.getComponentId();
|
|
|
+ if (!Check.isNull(componentIdStr)){
|
|
|
+ String[] componentId = componentIdStr.split(",");
|
|
|
+ for (String strId : componentId) {
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.put("component_id",new Long(strId));
|
|
|
+ component.add(obj);
|
|
|
+ }
|
|
|
+ creObj.put("component_materials",component);
|
|
|
+ }
|
|
|
|
|
|
- Integer isCommentDisable = strategy.getCreativeIsCommentDisable();
|
|
|
- if(!Check.isNull(isCommentDisable)&&isCommentDisable!=0){
|
|
|
- params.put("is_comment_disable",isCommentDisable);
|
|
|
- }
|
|
|
- String creativeDisplayMode = strategy.getCreativeDisplayMode();
|
|
|
- if(!Check.isNull(creativeDisplayMode)){
|
|
|
- params.put("creative_display_mode",creativeDisplayMode);
|
|
|
- }
|
|
|
-// 允许客户端下载视频功能
|
|
|
-// Integer adDownloadStatus = strategy.getCreativeAdDownloadStatus();
|
|
|
-// if(!Check.isNull(adDownloadStatus)&&adDownloadStatus!=0){
|
|
|
-// params.put("ad_download_status",adDownloadStatus);
|
|
|
-// }
|
|
|
- //商品推广卡片
|
|
|
- String imageCode = strategy.getCreativeProductImageCode();
|
|
|
- if(!Check.isNull(imageCode)){
|
|
|
- //1:根据imageCode获取图片id
|
|
|
- JSONObject promotionCard = new JSONObject();
|
|
|
- String iconImageId = getBytedanceImageIdByCode(imageCode,token);
|
|
|
- if(!Check.isNull(iconImageId)){
|
|
|
- promotionCard.put("product_image_id",iconImageId);
|
|
|
- }
|
|
|
- String productSellingPoints = strategy.getCreativeProductSellingPoints();
|
|
|
- if(!Check.isNull(productSellingPoints)){
|
|
|
- String[] pointString = productSellingPoints.split(",");
|
|
|
- if(pointString.length>0){
|
|
|
- promotionCard.put("product_selling_points",pointString);
|
|
|
- }
|
|
|
- }
|
|
|
- String productDescription = strategy.getCreativeProductDescription();
|
|
|
- if(!Check.isNull(productDescription)){
|
|
|
- promotionCard.put("product_description",productDescription);
|
|
|
- }
|
|
|
- Boolean enableStorePack = strategy.getCreativeEnablePersonalAction();
|
|
|
- if(null!=enableStorePack){
|
|
|
- promotionCard.put("enable_store_pack",enableStorePack);
|
|
|
- }
|
|
|
- String callToAction = strategy.getCreativeCallToAction();
|
|
|
- if(!Check.isNull(callToAction)){
|
|
|
- promotionCard.put("call_to_action",callToAction);
|
|
|
- }
|
|
|
- Boolean enablePersonalAction = strategy.getCreativeEnablePersonalAction();
|
|
|
- if(null!=enablePersonalAction){
|
|
|
- promotionCard.put("enable_personal_action",enablePersonalAction);
|
|
|
- }
|
|
|
- params.put("promotion_card",promotionCard);
|
|
|
- }
|
|
|
- //行业类别
|
|
|
- String thirdIndustryId = strategy.getCreativeThirdIndustryId();
|
|
|
- if(!Check.isNull(thirdIndustryId)){
|
|
|
- params.put("third_industry_id",thirdIndustryId);
|
|
|
- }
|
|
|
- //关键词 添加随机关键词逻辑
|
|
|
- String adKeywords = strategy.getCreativeAdKeywords();
|
|
|
- if(!Check.isNull(adKeywords)){
|
|
|
- String [] keywords = adKeywords.split(",");
|
|
|
- if(keywords.length>0){
|
|
|
- if(keywords.length<=20){
|
|
|
- params.put("ad_keywords",keywords);
|
|
|
- }else {
|
|
|
- List<String>keywordList = Arrays.asList(keywords);
|
|
|
- Collections.shuffle(keywordList);
|
|
|
- List<String> getKeyWords = keywordList.subList(0,20);
|
|
|
- params.put("ad_keywords",getKeyWords);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- String trackUrl = strategy.getCreativeTrackUrl();
|
|
|
- if(!Check.isNull(trackUrl)){
|
|
|
- params.put("track_url",trackUrl);
|
|
|
- }
|
|
|
- String actionTrackUrl = strategy.getCreativeActionTrackUrl();
|
|
|
- if(!Check.isNull(actionTrackUrl)){
|
|
|
- params.put("action_track_url",actionTrackUrl);
|
|
|
- }
|
|
|
- String videoPlayEffectiveTrackUrl = strategy.getCreativeVideoPlayEffectiveTrackUrl();
|
|
|
- if(!Check.isNull(videoPlayEffectiveTrackUrl)){
|
|
|
- params.put("video_play_effective_track_url",videoPlayEffectiveTrackUrl);
|
|
|
- }
|
|
|
-// String videoPlayDoneTrackUrl = strategy.getCreativeVideoPlayDoneTrackUrl();
|
|
|
-// if(!Check.isNull(videoPlayDoneTrackUrl)){
|
|
|
-// params.put("video_play_done_track_url",videoPlayDoneTrackUrl);
|
|
|
-// }
|
|
|
- String videoPlayTrackUrl = strategy.getCreativeVideoPlayTrackUrl();
|
|
|
- if(!Check.isNull(videoPlayTrackUrl)){
|
|
|
- params.put("video_play_track_url",videoPlayTrackUrl);
|
|
|
- }
|
|
|
+ params.put("creative",creObj);
|
|
|
return params;
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
private String getBytedanceImageIdByCode(String imageCode, CtopOauthToken token) {
|
|
|
//1:根据code获取图片信息
|
|
|
BytedanceImageInfo bytedanceImageInfo = bytedanceImageInfoService.getByParams(imageCode);
|
|
@@ -586,18 +572,63 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
params.put("name",adName);
|
|
|
//竞价策略 默认优先跑量
|
|
|
params.put("flow_control_mode","FLOW_CONTROL_MODE_FAST");
|
|
|
+
|
|
|
+ // 搜索快投
|
|
|
+ if(!"UNION".equals(strategy.getAdDeliveryRange())){
|
|
|
+ params.put("feed_delivery_search","DISABLED");
|
|
|
+ }
|
|
|
+
|
|
|
//投放范围
|
|
|
- if(null!=strategy.getAdDeliveryRange()&&!"".equals(strategy.getAdDeliveryRange().trim())){
|
|
|
+ if(null!=strategy.getAdDeliveryRange() && !"".equals(strategy.getAdDeliveryRange().trim())){
|
|
|
params.put("delivery_range",strategy.getAdDeliveryRange());
|
|
|
- if(!"UNION".equals(strategy.getAdDeliveryRange())){
|
|
|
+ //搜索快投
|
|
|
+ /*if(!"UNION".equals(strategy.getAdDeliveryRange())){
|
|
|
params.put("feed_delivery_search","DISABLED");
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+
|
|
|
+ //点击监测链接
|
|
|
+ String actionTrackUrl = strategy.getCreativeActionTrackUrl();
|
|
|
+ if(!Check.isNull(actionTrackUrl)){
|
|
|
+ params.put("action_track_url",new String[]{actionTrackUrl});
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //广告位大类
|
|
|
+ if (!Check.isNull(strategy.getInventoryCatalog())){
|
|
|
+ params.put("inventory_catalog",strategy.getInventoryCatalog());
|
|
|
+ }else{
|
|
|
+ params.put("inventory_catalog","MANUAL");
|
|
|
+ }
|
|
|
+
|
|
|
+ //广告投放位置
|
|
|
+ String inventoryType = strategy.getCreativeInventoryType();
|
|
|
+ if ("CREATIVE_IMAGE_MODE_UNION_SPLASH".equalsIgnoreCase(strategy.getCreativeImageMode())) {
|
|
|
+ params.put("inventory_type", new String[]{"INVENTORY_UNION_SPLASH_SLOT"});
|
|
|
+ } else {
|
|
|
+ if (null != inventoryType && !"".equals(inventoryType)) {
|
|
|
+ String[] inventoryTypeString = inventoryType.split(",");
|
|
|
+ if (inventoryTypeString.length > 0) {
|
|
|
+ params.put("inventory_type", inventoryTypeString);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ //优选广告位
|
|
|
+ if (!Check.isNull(strategy.getCreativeSmartInventory())){
|
|
|
+ params.put("smart_inventory",strategy.getCreativeSmartInventory());
|
|
|
+ }else{
|
|
|
+ params.put("smart_inventory","NORMAL");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 投放形式
|
|
|
if(!Check.isNull(strategy.getAdUnionVideoType())){
|
|
|
params.put("union_video_type",strategy.getAdUnionVideoType());
|
|
|
}
|
|
|
- //投放目标
|
|
|
+
|
|
|
+ //下载方式
|
|
|
params.put("download_type",strategy.getAdDownloadType());
|
|
|
+
|
|
|
+
|
|
|
if(!Check.isNull(strategy.getAdDownloadUrl())){
|
|
|
params.put("download_url",strategy.getAdDownloadUrl());
|
|
|
}
|
|
@@ -609,9 +640,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
if(!Check.isNull(strategy.getAdQuickAppUrl())){
|
|
|
params.put("quick_app_url",strategy.getAdQuickAppUrl());
|
|
|
}
|
|
|
- if(!Check.isNull(strategy.getAdExternalUrl())){
|
|
|
- params.put("external_url",strategy.getAdExternalUrl());
|
|
|
- }
|
|
|
+
|
|
|
if(!Check.isNull(strategy.getAdAppType())){
|
|
|
params.put("app_type",strategy.getAdAppType());
|
|
|
}
|
|
@@ -1050,8 +1079,14 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
if(null != strategy.getCampaignDeliveryRelatedNum()&&!"".equals(strategy.getCampaignDeliveryRelatedNum().trim())){
|
|
|
campaignParam.put("delivery_related_num",strategy.getCampaignDeliveryRelatedNum());
|
|
|
}
|
|
|
+ //营销目的 --行动转化
|
|
|
+ //营销目的,允许值CONVERSION行动转化、INTENTION用户意向、ACKNOWLEDGE品牌认知
|
|
|
+ campaignParam.put("marketing_purpose",strategy.getMarketingPurpose());
|
|
|
+ //广告类型 允许值FEED信息流、SEARCH搜索广告
|
|
|
+ campaignParam.put("campaign_type",strategy.getCampaignType());
|
|
|
//创建组
|
|
|
Result campaignData = marketingService.createCampaign(token, campaignParam);
|
|
|
+ log.info("===创建组==={}",campaignData);
|
|
|
if(campaignData.getCode()!=0){
|
|
|
AiBytedanceAutocreateLog iBytedanceAutocreateLog = new AiBytedanceAutocreateLog(
|
|
|
strategy.getAccountId(),
|
|
@@ -1223,12 +1258,12 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
// 出价不为空 则 固定出价
|
|
|
if (!Check.isNull(updAdStaOrCpaOrBudget.getAdCpaBid())){
|
|
|
// 出价 > 计划预算
|
|
|
- a = updAdStaOrCpaOrBudget.getAdCpaBid().compareTo(new BigDecimal(strategyVo.getAdBudget()));
|
|
|
+ a = updAdStaOrCpaOrBudget.getAdCpaBid().compareTo(strategyVo.getAdBudget());
|
|
|
//出价为空 则 随机出价 或者 阶梯出价
|
|
|
// 最高出价 不能大于 计划预算
|
|
|
}else {
|
|
|
// 最高出价 > 计划预算
|
|
|
- a = updAdStaOrCpaOrBudget.getAdMaxBid().compareTo(new BigDecimal(strategyVo.getAdBudget()));
|
|
|
+ a = updAdStaOrCpaOrBudget.getAdMaxBid().compareTo(strategyVo.getAdBudget());
|
|
|
}
|
|
|
if (a == 1){
|
|
|
return Result.errorMsg("最高出价不能大于计划预算。");
|
|
@@ -1506,11 +1541,11 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
aiBytedanceAdvertiserStrategy.setStatus(0);
|
|
|
|
|
|
//添加素材信息
|
|
|
- MaterialImageInfo imageInfo = new MaterialImageInfo();
|
|
|
+ /* MaterialImageInfo imageInfo = new MaterialImageInfo();
|
|
|
imageInfo.setUrl(aiBytedanceAdvertiserStrategy.getImageUrl());
|
|
|
imageInfo.setUserId(aiBytedanceAdvertiserStrategy.getUserId());
|
|
|
materialImageInfoService.initImageCode(imageInfo);
|
|
|
-
|
|
|
+*/
|
|
|
|
|
|
|
|
|
aiBytedanceAdvertiserStrategyMapper.insert(aiBytedanceAdvertiserStrategy);
|
|
@@ -1788,4 +1823,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
}
|