|
@@ -356,7 +356,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
if ("video".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
//视频类型
|
|
|
//1-竖版视频 2-横版视频
|
|
|
- String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_VIDEO_VERTICAL" : "CREATIVE_IMAGE_MODE_VIDEO";
|
|
|
+// 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
|
|
@@ -366,7 +367,8 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
}
|
|
|
}else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
//1-大图横图; 2-大图竖图
|
|
|
- String imageMode = videoInfo.getType() == 1 ? "CREATIVE_IMAGE_MODE_LARGE" : "CREATIVE_IMAGE_MODE_LARGE_VERTICAL";
|
|
|
+// 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()});
|
|
|
}
|
|
@@ -375,6 +377,7 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
params.put("image_list",imageArray);
|
|
|
JSONArray titleArray = new JSONArray();
|
|
|
List<BytedanceVideoSlogenInfo> slogenInfos = slogenInfoService.listByParams(videoInfo.getSignature(),1);
|
|
|
+ //使用指定文案
|
|
|
if(!Check.isNull(slogenInfos)){
|
|
|
for (BytedanceVideoSlogenInfo slogenInfo:slogenInfos) {
|
|
|
if(titleArray.size() >= 10){ //接口中是要求一个视频最多10个标题
|
|
@@ -392,24 +395,43 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
|
|
|
titleArray.add(titleObject);
|
|
|
}
|
|
|
}
|
|
|
- for(int i = 0; i < 3; i++){
|
|
|
- if(titleArray.size() >= 10){
|
|
|
- break;
|
|
|
+ // 视频 指定文案不够的时候 使用通用文案 最多3条
|
|
|
+ if ("video".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
+ for(int i = 0; i < 3; i++){
|
|
|
+ if(titleArray.size() >= 10){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ ByteDanceGeneralCopywriter byteDanceGeneralCopywriter = byteDanceGeneralCopywriterMapper.getRandOne(strategy.getAccountId());
|
|
|
+ if(!Check.isNull(byteDanceGeneralCopywriter)){
|
|
|
+ JSONObject titleObject = new JSONObject();
|
|
|
+ titleObject.put("title",byteDanceGeneralCopywriter.getTextCopywriter());
|
|
|
+ String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
|
|
|
+ if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
+ JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
+ if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
+ titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ titleArray.add(titleObject);
|
|
|
+ }
|
|
|
}
|
|
|
- ByteDanceGeneralCopywriter byteDanceGeneralCopywriter = byteDanceGeneralCopywriterMapper.getRandOne(strategy.getAccountId());
|
|
|
- if(!Check.isNull(byteDanceGeneralCopywriter)){
|
|
|
- JSONObject titleObject = new JSONObject();
|
|
|
- titleObject.put("title",byteDanceGeneralCopywriter.getTextCopywriter());
|
|
|
- String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
|
|
|
- if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
- JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
- if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
- titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
+ // 图片 使用通用文案 最多10条
|
|
|
+ }else if ("image".equalsIgnoreCase(videoInfo.getMaterialType())){
|
|
|
+ List<ByteDanceGeneralCopywriter> byteDanceGeneralCopywriterList = byteDanceGeneralCopywriterMapper.getRandTen(strategy.getAccountId());
|
|
|
+ if(!Check.isNull(byteDanceGeneralCopywriterList)){
|
|
|
+ for (ByteDanceGeneralCopywriter byteDanceGeneralCopywriter : byteDanceGeneralCopywriterList){
|
|
|
+ JSONObject titleObject = new JSONObject();
|
|
|
+ titleObject.put("title",byteDanceGeneralCopywriter.getTextCopywriter());
|
|
|
+ String creativeWordsIds = byteDanceGeneralCopywriter.getCreativeWordIds();
|
|
|
+ if(null!=creativeWordsIds&&!creativeWordsIds.trim().equals("")){
|
|
|
+ JSONArray creativeWordsArray = JSON.parseArray(creativeWordsIds);
|
|
|
+ if(null!=creativeWordsArray&&!creativeWordsArray.isEmpty()){
|
|
|
+ titleObject.put("creative_word_ids",creativeWordsArray);
|
|
|
+ }
|
|
|
}
|
|
|
+ titleArray.add(titleObject);
|
|
|
}
|
|
|
- titleArray.add(titleObject);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if(!Check.isNull(titleArray)){
|