|
@@ -394,25 +394,45 @@ 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)){
|
|
|
params.put("title_list",titleArray);
|
|
|
}
|