|
@@ -20,7 +20,8 @@ import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouDirectionalPackage;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouProjectStrategy;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouVideoDirectionalPackage;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeAdsenceTypeEnum;
|
|
|
-import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouCreativeMatTypeEnum;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouProjectCreativeMatTypeEnum;
|
|
|
+import cn.com.ctop.kuaishou.modules.ai.enums.KuaishouProjectCreativeMatTypeEnum;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouVideoDirectionalPackageMapper;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouAccountLevelOperationRecordService;
|
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IAiKuaishouCampaignLevelOperationRecordService;
|
|
@@ -177,6 +178,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
try {
|
|
|
String strategyUuid = UUID.randomUUID().toString();
|
|
|
strategy.setStrategyUuid(strategyUuid);
|
|
|
+ strategy.setUnitType(4);
|
|
|
Long accountId = strategy.getAccountId();
|
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId.toString());
|
|
|
if (null == token) {
|
|
@@ -186,8 +188,8 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
}
|
|
|
//1:获取视频信息
|
|
|
kuaishouInterfaceService.getVideoList(token, DateUtils.date2Str(), DateUtils.date2Str());
|
|
|
- Long timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
- Long timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
+ Long timeStart = KuaishouProjectCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
+ Long timeEnd = KuaishouProjectCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
Long now = System.currentTimeMillis();
|
|
|
String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
|
|
|
String endTime = DateUtils.formatDateTime(now + timeEnd * 60 * 1000L);
|
|
@@ -196,7 +198,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
//单/多应用,1单应用,2多应用
|
|
|
if (null != singleAppid && singleAppid == 1) {
|
|
|
//单一应用
|
|
|
- String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
+ String replaceString = KuaishouProjectCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
List<KuaiShouVideoGet> newVideos = getVideosByParams(strategy, startTime, endTime, null, createType, Long.valueOf(videoCnt));
|
|
|
if (null == newVideos || newVideos.isEmpty()) {
|
|
|
log.info("账户:{},{} 到 {} 未获取到相应素材({})", accountId, startTime, endTime, replaceString);
|
|
@@ -319,8 +321,8 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
timeStart = -7 * 60 * 24L;
|
|
|
timeEnd = -5L;
|
|
|
} else {
|
|
|
- timeStart = KuaishouCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
- timeEnd = KuaishouCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
+ timeStart = KuaishouProjectCreativeMatTypeEnum.getStartTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
+ timeEnd = KuaishouProjectCreativeMatTypeEnum.getEndTimeByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
}
|
|
|
Long now = System.currentTimeMillis();
|
|
|
String startTime = DateUtils.formatDateTime(now + timeStart * 60 * 1000L);
|
|
@@ -330,7 +332,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
|
|
|
//单/多应用,1单应用,2多应用
|
|
|
if (null != singleAppid && singleAppid == 1) {
|
|
|
- String replaceString = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
+ String replaceString = KuaishouProjectCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
//单一应用
|
|
|
List<KuaiShouVideoGet> allVideos = getVideosByParams(strategy, startTime, endTime, null, createType, Long.valueOf(videoCnt));
|
|
|
if (null == allVideos) {
|
|
@@ -1139,6 +1141,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
int imageNumber, KuaishouProjectStrategy strategy, String uuid, String appVersion) {
|
|
|
if ((null != cutFrameList && !cutFrameList.isEmpty())) {
|
|
|
for (int i = 0; i < cutFrameList.size(); i++) {
|
|
|
+ creativeParams.put("action_bar_text", getActionBar(strategy.getActionBarText()));
|
|
|
String imageCode = cutFrameList.get(i).getSignature();
|
|
|
String imageUrl = cutFrameList.get(i).getUrl();
|
|
|
String imageToken = getImageToken(imageUrl, imageCode, token.getAccountId(), token.getAccessToken());
|
|
@@ -1171,7 +1174,6 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
creativeParams.put("unit_id", unitId);
|
|
|
creativeParams.put("photo_id", videoItem.getPhotoId());
|
|
|
creativeParams.put("creative_material_type", videoItem.getMaterialType());
|
|
|
- creativeParams.put("action_bar_text", getActionBar(strategy.getActionBarText()));
|
|
|
JSONArray descArr = JSONArray.parseArray(strategy.getDescription());
|
|
|
int index = new Random().nextInt(descArr.size());
|
|
|
String description = descArr.getString(index);
|
|
@@ -1334,11 +1336,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
} else if ("unit".equals(type)) {
|
|
|
wildcard = wildcard.replace("{{日期}}", nowDate);
|
|
|
}
|
|
|
- String HOUR = DateUtils.formatDate(date, DateUtils.TIME_FORMAT);
|
|
|
- if (wildcard.contains("{{时分}}")) {
|
|
|
- wildcard = wildcard.replace("{{时分}}", HOUR);
|
|
|
- }
|
|
|
- String targetName = KuaishouCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
+ String targetName = KuaishouProjectCreativeMatTypeEnum.getNameByType(strategy.getUnitType().toString() + createType.toString());
|
|
|
wildcard = wildcard.replace("{{自定义}}", targetName);
|
|
|
if (!Check.isNull(campaignId)) {
|
|
|
Integer count = null;
|
|
@@ -1365,6 +1363,12 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
|
}
|
|
|
wildcard = wildcard + "-" + count;
|
|
|
}
|
|
|
+ String HOUR = DateUtils.formatDate(date, DateUtils.TIME_FORMAT);
|
|
|
+ if (wildcard.contains("{{时分}}")) {
|
|
|
+ wildcard = wildcard.replace("{{时分}}", HOUR);
|
|
|
+ }else{
|
|
|
+ wildcard = wildcard.concat(HOUR.substring(0,4));
|
|
|
+ }
|
|
|
wildcard = wildcard.replace("--", "-");
|
|
|
if (wildcard.startsWith("-")) {
|
|
|
wildcard = wildcard.substring(1, wildcard.length());
|