|
@@ -19,17 +19,21 @@ import cn.com.ctop.kuaishou.modules.batch.service.*;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.util.DateUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.ParseException;
|
|
|
import java.util.*;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
|
public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCreativeService {
|
|
|
@Autowired
|
|
|
+ private IKuaiShouGroupService groupService;
|
|
|
+ @Autowired
|
|
|
private IKuaiShouGroupTemplateService groupTemplateService;
|
|
|
@Autowired
|
|
|
private ICtopOauthTokenService tokenService;
|
|
@@ -50,17 +54,26 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
@Autowired
|
|
|
private IAiKuaiShouAppInfoService appInfoService;
|
|
|
|
|
|
+
|
|
|
+
|
|
|
String getReplaceStringByCreateType(AiKuaishouAdvertiserStrategy strategy, Integer createType) {
|
|
|
- String replaceString;
|
|
|
- if (createType == 2) {
|
|
|
- replaceString = "历史高质量";
|
|
|
- } else if (createType == 3) {
|
|
|
- replaceString = "素材上新";
|
|
|
- } else {
|
|
|
- replaceString = "素材上新";
|
|
|
- }
|
|
|
- if (strategy.getUnitType() == 7) {
|
|
|
- replaceString = "程序化" + replaceString;
|
|
|
+ String replaceString = "自定义上新";
|
|
|
+ if(strategy.getUnitType() == 7){
|
|
|
+ if (createType == 2) {
|
|
|
+ replaceString = "程序化高质量";
|
|
|
+ } else if (createType == 3) {
|
|
|
+ replaceString = "程序化上新";
|
|
|
+ } else if(createType == 4){
|
|
|
+ replaceString = "程序化素材";
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if (createType == 2) {
|
|
|
+ replaceString = "自定义高质量";
|
|
|
+ } else if (createType == 3) {
|
|
|
+ replaceString = "自定义上新";
|
|
|
+ } else if(createType == 4){
|
|
|
+ replaceString = "自定义历史";
|
|
|
+ }
|
|
|
}
|
|
|
return replaceString;
|
|
|
}
|
|
@@ -73,14 +86,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
* @param videoCnt
|
|
|
*/
|
|
|
@Override
|
|
|
- public void autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Integer videoCnt) {
|
|
|
+ public Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt) {
|
|
|
strategy.setUnitType(4);
|
|
|
String replaceString = getReplaceStringByCreateType(strategy, createType);
|
|
|
Long accountId = strategy.getAccountId();
|
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
|
|
|
if (null == token) {
|
|
|
log.info("token获取失败=>accountId:{}", accountId);
|
|
|
- return;
|
|
|
+ return videoCnt;
|
|
|
}
|
|
|
//1:获取视频信息
|
|
|
kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(), DateUtils.date2Str());
|
|
@@ -125,9 +138,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
}
|
|
|
replaceString = appInfo.getAppVersion() + replaceString;
|
|
|
//1:查询素材
|
|
|
- List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType);
|
|
|
+ List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType,videoCnt);
|
|
|
if (null == allVideos || allVideos.isEmpty()) {
|
|
|
- return;
|
|
|
+ log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime,replaceString);
|
|
|
+ return videoCnt;
|
|
|
}
|
|
|
Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN");
|
|
|
|
|
@@ -139,7 +153,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
|
|
|
if (null != overrunInfo) {
|
|
|
log.info("该账户创意创建已超限=>accountId:{}", accountId);
|
|
|
- return;
|
|
|
+ return 0L;
|
|
|
+ }
|
|
|
+ // 获取视频封面数据
|
|
|
+ List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
|
|
|
+ if ((null == cutFrameList || cutFrameList.isEmpty())) {
|
|
|
+ log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
|
|
|
+ continue;
|
|
|
}
|
|
|
unitCnt++;
|
|
|
String unitName = unitNamePrefix + "-" + unitCnt;
|
|
@@ -152,28 +172,25 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
continue;
|
|
|
}
|
|
|
Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
-
|
|
|
- // 每个组,搭配n个创意
|
|
|
- List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
|
|
|
- if ((null == cutFrameList || cutFrameList.isEmpty())) {
|
|
|
- log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
|
|
|
- continue;
|
|
|
- }
|
|
|
+ videoCnt --;
|
|
|
JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
|
|
|
createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt());
|
|
|
+ if(videoCnt<=0){
|
|
|
+ return videoCnt;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
//单一应用
|
|
|
- List<KuaiShouVideoGet> newVideos = getVideosByParams(strategy, startTime, endTime, null, 100);
|
|
|
+ List<KuaiShouVideoGet> newVideos = getVideosByParams(strategy, startTime, endTime, null, createType,videoCnt);
|
|
|
if (null == newVideos || newVideos.isEmpty()) {
|
|
|
- log.info("账户:{},{} 到 {} 这段时间没有上新素材", accountId, startTime, endTime);
|
|
|
- return;
|
|
|
+ log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime,replaceString);
|
|
|
+ return videoCnt;
|
|
|
}
|
|
|
Long newCampaignId = getCampaignId(strategy, token, replaceString, "TODAY");
|
|
|
if (null == newCampaignId) {
|
|
|
- return;
|
|
|
+ return videoCnt;
|
|
|
}
|
|
|
|
|
|
//3、在“上新”计划中新增广告组,一个素材搭配n张封面,组成一个广告组
|
|
@@ -183,7 +200,13 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
for (KuaiShouVideoGet videoItem : newVideos) {
|
|
|
KuaishouAccountCreativeOverrunInfo overrunInfo = overrunInfoService.getByParams(accountId, DateUtils.formatDate(new Date()));
|
|
|
if (null != overrunInfo) {
|
|
|
- return;
|
|
|
+ return 0L;
|
|
|
+ }
|
|
|
+ // 每个组,搭配5个创意
|
|
|
+ List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
|
|
|
+ if ((null == cutFrameList || cutFrameList.isEmpty())) {
|
|
|
+ log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
|
|
|
+ continue;
|
|
|
}
|
|
|
unitCnt++;
|
|
|
String unitName = unitNamePrefix + "-" + unitCnt;
|
|
@@ -197,19 +220,16 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
continue;
|
|
|
}
|
|
|
Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
-
|
|
|
- // 每个组,搭配5个创意
|
|
|
- List<MaterialCutFrame> cutFrameList = materialCutFrameService.getListByVideoSignature(videoItem.getSignature());
|
|
|
- if ((null == cutFrameList || cutFrameList.isEmpty())) {
|
|
|
- log.info("未获取到视频封面=>videoSignature:{}", videoItem.getSignature());
|
|
|
- continue;
|
|
|
- }
|
|
|
+ videoCnt -- ;
|
|
|
JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
|
|
|
createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt());
|
|
|
+ if(videoCnt<=0){
|
|
|
+ return 0L;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ return videoCnt;
|
|
|
}
|
|
|
-
|
|
|
private String getUnitNamePrefix(AiKuaishouAdvertiserStrategy strategy,String replaceString,String timestamp){
|
|
|
String unitNamePrefix = strategy.getGroupName();
|
|
|
if(!unitNamePrefix.contains("自定义")){
|
|
@@ -217,13 +237,14 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
}
|
|
|
return unitNamePrefix.replace("自定义", replaceString) + timestamp;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 创建程序化创意
|
|
|
*
|
|
|
* @param strategy
|
|
|
*/
|
|
|
@Override
|
|
|
- public void autoCreateProgramCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Integer videoCnt) {
|
|
|
+ public void autoCreateProgramCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt) {
|
|
|
strategy.setUnitType(7);
|
|
|
String replaceString = getReplaceStringByCreateType(strategy, createType);
|
|
|
Long accountId = strategy.getAccountId();
|
|
@@ -276,7 +297,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
}
|
|
|
replaceString = appInfo.getAppVersion() + replaceString;
|
|
|
//1:查询可用素材
|
|
|
- List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType);
|
|
|
+ List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, appInfo, createType,videoCnt);
|
|
|
if (null == allVideos) {
|
|
|
return;
|
|
|
}
|
|
@@ -287,22 +308,23 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
return;
|
|
|
}
|
|
|
Long newCampaignId = getCampaignId(strategy, token, replaceString, "ALL_CAMPAIGN");
|
|
|
- //创建组
|
|
|
- String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
- String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
|
|
|
- String unitName = unitNamePrefix + "-" + timestamp;
|
|
|
- JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
|
- Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
- Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
|
- String unitMessage = (String) unitCreateResult.get("message");
|
|
|
- if (unitCode != 0) {
|
|
|
- log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
- continue;
|
|
|
- }
|
|
|
- Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
+
|
|
|
//创意
|
|
|
- List<List<KuaiShouVideoGet>> splitVideos = new ListUtils<KuaiShouVideoGet>().split(allVideos, allVideos.size() / 5);
|
|
|
+ List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos,5);
|
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
|
+ //创建组
|
|
|
+ String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
+ String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
|
|
|
+ String unitName = unitNamePrefix + "-" + timestamp;
|
|
|
+ JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appInfo.getAppId());
|
|
|
+ Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
+ Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
|
+ String unitMessage = (String) unitCreateResult.get("message");
|
|
|
+ if (unitCode != 0) {
|
|
|
+ log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j);
|
|
|
createProgramCreative(token, creativeParams);
|
|
|
}
|
|
@@ -310,7 +332,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
}
|
|
|
} else {
|
|
|
//单一应用
|
|
|
- List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType);
|
|
|
+ List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType,videoCnt);
|
|
|
if (null == allVideos) {
|
|
|
return;
|
|
|
}
|
|
@@ -319,33 +341,50 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if (null == newCampaignId) {
|
|
|
return;
|
|
|
}
|
|
|
- //创建组
|
|
|
- String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
- String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
|
|
|
- String unitName = unitNamePrefix + "-" + timestamp;
|
|
|
- String appIdString = strategy.getAppIdArray();
|
|
|
- Long appId = null;
|
|
|
- if(!Check.isNull(appIdString)&&!Check.isNull(JSON.parseArray(appIdString))){
|
|
|
- appId = JSON.parseArray(appIdString).getLong(0);
|
|
|
- }
|
|
|
- JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
|
- Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
- Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
|
- String unitMessage = (String) unitCreateResult.get("message");
|
|
|
- if (unitCode != 0) {
|
|
|
- log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
- return;
|
|
|
- }
|
|
|
- Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
+
|
|
|
//创意
|
|
|
- List<List<KuaiShouVideoGet>> splitVideos = new ListUtils<KuaiShouVideoGet>().split(allVideos, allVideos.size() / 5);
|
|
|
+ List<List<KuaiShouVideoGet>> splitVideos = Lists.partition(allVideos,5);
|
|
|
for (int j = 1; j < splitVideos.size() + 1; j++) {
|
|
|
+ //创建组
|
|
|
+ String timestamp = DateUtils.formatDate(new Date(), "yyyyMMddHHmmss");
|
|
|
+ String unitNamePrefix = getUnitNamePrefix(strategy,replaceString,timestamp);
|
|
|
+ String unitName = unitNamePrefix + "-" + timestamp;
|
|
|
+ String appIdString = strategy.getAppIdArray();
|
|
|
+ Long appId = null;
|
|
|
+ if(!Check.isNull(appIdString)&&!Check.isNull(JSON.parseArray(appIdString))){
|
|
|
+ appId = JSON.parseArray(appIdString).getLong(0);
|
|
|
+ }
|
|
|
+ JSONObject unitParams = createUnitParams(token, newCampaignId, strategy, unitName, appId);
|
|
|
+ Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
|
+ Integer unitCode = (Integer) unitCreateResult.get("code");
|
|
|
+ String unitMessage = (String) unitCreateResult.get("message");
|
|
|
+ if (unitCode != 0) {
|
|
|
+ log.info("组创建失败=>accountId:{};message:{}", accountId, unitMessage);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Long unitId = (Long) unitCreateResult.get("unitId");
|
|
|
JSONObject creativeParams = programCreativeParams(token, unitId, splitVideos.get(j - 1), strategy, j);
|
|
|
createProgramCreative(token, creativeParams);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy) throws ParseException {
|
|
|
+ //获取当前小时数 ,计算截止当前应当创建的组数量
|
|
|
+ Integer hour = DateUtils.getNowHour();
|
|
|
+ Long unitNum = strategy.getCustomUnitCnt()/20*hour;
|
|
|
+ //查询当前账户创建自定义类型组数量
|
|
|
+ int unitCreateCnt = groupService.queryToDayBuiltCount(strategy.getAccountId());
|
|
|
+ long remindCnt = unitNum-unitCreateCnt;
|
|
|
+ if(remindCnt>=1){
|
|
|
+ //优先创建历史遗漏素材
|
|
|
+ remindCnt = this.autoCreateCreative(strategy,3,remindCnt);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void createProgramCreative(CtopOauthToken token, JSONObject creativeParams) {
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Content-Type", "application/json");
|
|
@@ -425,25 +464,30 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
}
|
|
|
|
|
|
private List<KuaiShouVideoGet> getNewVideoListByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo) {
|
|
|
- List<KuaiShouVideoGet> generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), null, null);
|
|
|
- //2:查询特定素材
|
|
|
- List<KuaiShouVideoGet> customVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), appInfo.getAppVersion(), null);
|
|
|
- if (Check.isNull(generalVideos) && Check.isNull(customVideos)) {
|
|
|
+ if(null == appInfo){
|
|
|
+ return videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), null, null);
|
|
|
+ }else{
|
|
|
+ //查询通用素材
|
|
|
+ List<KuaiShouVideoGet> generalVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), "all", null);
|
|
|
+ //2:查询特定素材
|
|
|
+ List<KuaiShouVideoGet> customVideos = videoGetService.getNewVideoBetweenTime(strategy.getAccountId(), startTime, endTime, strategy.getChannelType(), appInfo.getAppVersion(), null);
|
|
|
+ if (Check.isNull(generalVideos) && Check.isNull(customVideos)) {
|
|
|
log.info("账户:{},appId({}){}到{}这段时间没有上新素材", strategy.getAccountId(), appInfo.getAppId(), startTime, endTime);
|
|
|
- return new ArrayList<>();
|
|
|
- }
|
|
|
- //合并
|
|
|
- if (null == generalVideos||generalVideos.isEmpty()) {
|
|
|
- return customVideos;
|
|
|
- } else if (null == customVideos||customVideos.isEmpty()) {
|
|
|
- return generalVideos;
|
|
|
- } else {
|
|
|
- generalVideos.addAll(customVideos);
|
|
|
- return generalVideos;
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ //合并
|
|
|
+ if (null == generalVideos||generalVideos.isEmpty()) {
|
|
|
+ return customVideos;
|
|
|
+ } else if (null == customVideos||customVideos.isEmpty()) {
|
|
|
+ return generalVideos;
|
|
|
+ } else {
|
|
|
+ generalVideos.addAll(customVideos);
|
|
|
+ return generalVideos;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private List<KuaiShouVideoGet> getRelateZeroVideoList(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo,Integer relativeCnt) {
|
|
|
+ private List<KuaiShouVideoGet> getRelateZeroVideoList(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo,Integer relativeCnt,Long videoCnt) {
|
|
|
Integer channelType = null;
|
|
|
if (null != strategy.getChannelType() && strategy.getChannelType() != 2) {
|
|
|
channelType = strategy.getChannelType();
|
|
@@ -452,10 +496,10 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if(null!=appInfo&&null!=appInfo.getAppVersion()){
|
|
|
appVersion = appInfo.getAppVersion();
|
|
|
}
|
|
|
- return videoGetService.getZeroVideoByParams(strategy.getAccountId(), startTime, endTime, 100, appVersion, channelType,relativeCnt);
|
|
|
+ return videoGetService.getZeroVideoByParams(strategy.getAccountId(), startTime, endTime, videoCnt, appVersion, channelType,relativeCnt);
|
|
|
}
|
|
|
|
|
|
- private List<KuaiShouVideoGet> getHistoryTopVideoListByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo) {
|
|
|
+ private List<KuaiShouVideoGet> getHistoryTopVideoListByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo,Long videoCnt) {
|
|
|
Integer channelType = null;
|
|
|
if (null != strategy.getChannelType() && strategy.getChannelType() != 2) {
|
|
|
channelType = strategy.getChannelType();
|
|
@@ -464,7 +508,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
if(null!=appInfo&&null!=appInfo.getAppVersion()){
|
|
|
appVersion = appInfo.getAppVersion();
|
|
|
}
|
|
|
- return videoGetService.getHistoryTopVideoByParams(strategy.getAccountId(), startTime, endTime, 100, appVersion, channelType);
|
|
|
+ return videoGetService.getHistoryTopVideoByParams(strategy.getAccountId(), startTime, endTime, videoCnt, appVersion, channelType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -475,15 +519,15 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
|
|
|
* @param startTime 开始时间
|
|
|
* @param endTime 结束时间
|
|
|
*/
|
|
|
- private List<KuaiShouVideoGet> getVideosByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo, Integer createType) {
|
|
|
+ private List<KuaiShouVideoGet> getVideosByParams(AiKuaishouAdvertiserStrategy strategy, String startTime, String endTime, AiKuaiShouAppInfo appInfo, Integer createType,Long videoCnt) {
|
|
|
if (createType == 1) {
|
|
|
return getNewVideoListByParams(strategy, startTime, endTime, appInfo);
|
|
|
} else if (createType == 2) {
|
|
|
- return getHistoryTopVideoListByParams(strategy, startTime, endTime, appInfo);
|
|
|
+ return getHistoryTopVideoListByParams(strategy, startTime, endTime, appInfo,videoCnt);
|
|
|
} else if(createType==3){
|
|
|
- return getRelateZeroVideoList(strategy, startTime, endTime, appInfo,0);
|
|
|
+ return getRelateZeroVideoList(strategy, startTime, endTime, appInfo,0,videoCnt);
|
|
|
}else{
|
|
|
- return getRelateZeroVideoList(strategy, startTime, endTime, appInfo,20);
|
|
|
+ return getRelateZeroVideoList(strategy, startTime, endTime, appInfo,20,videoCnt);
|
|
|
}
|
|
|
}
|
|
|
|