|
@@ -350,6 +350,9 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
unitLevelOperationRecord.setCreateType(2);//项目创建
|
|
unitLevelOperationRecord.setCreateType(2);//项目创建
|
|
Integer unitCode = -1;
|
|
Integer unitCode = -1;
|
|
String msg = unitParams.getString("errorMsg");
|
|
String msg = unitParams.getString("errorMsg");
|
|
|
|
+ String nowDate = DateUtils.formatDate(new Date(), "yy-MMdd");
|
|
|
|
+ String redisKey = strategy.getAccountId() + "_" + newCampaignId + nowDate;
|
|
|
|
+ Integer redisValue = (Integer) redisUtil.get(redisKey);
|
|
if (Check.isNull(msg)) {
|
|
if (Check.isNull(msg)) {
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
unitCode = (Integer) unitCreateResult.get("code");
|
|
unitCode = (Integer) unitCreateResult.get("code");
|
|
@@ -363,15 +366,16 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
videoCnt--;
|
|
videoCnt--;
|
|
JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
|
|
JSONObject creativeParams = creativeParams(token, unitId, videoItem, strategy);
|
|
createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
|
|
createCreativeByImage(cutFrameList, token, creativeParams, newCampaignId, unitId, videoItem, strategy.getImageCnt(), strategy, strategyUuid, null);
|
|
-
|
|
|
|
}
|
|
}
|
|
if (unitCode != 0) {
|
|
if (unitCode != 0) {
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
|
+ redisUtil.set(redisKey, redisValue - 1, 100000L);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
unitLevelOperationRecord.setStatus(unitCode);
|
|
unitLevelOperationRecord.setStatus(unitCode);
|
|
unitLevelOperationRecord.setMessage(msg);
|
|
unitLevelOperationRecord.setMessage(msg);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
|
+ redisUtil.set(redisKey, redisValue - 1, 100000L);
|
|
}
|
|
}
|
|
if (videoCnt <= 0) {
|
|
if (videoCnt <= 0) {
|
|
return videoCnt;
|
|
return videoCnt;
|
|
@@ -379,10 +383,12 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } catch (BeansException e) {
|
|
|
|
|
|
+ } catch (
|
|
|
|
+ BeansException e) {
|
|
log.error("创建自定义创意异常", e);
|
|
log.error("创建自定义创意异常", e);
|
|
insertAccountOperationRecord(strategy, "创建自定义创意异常", operationType, 0);
|
|
insertAccountOperationRecord(strategy, "创建自定义创意异常", operationType, 0);
|
|
}
|
|
}
|
|
|
|
+
|
|
insertAccountOperationRecord(strategy, "success", operationType, 1);
|
|
insertAccountOperationRecord(strategy, "success", operationType, 1);
|
|
return videoCnt;
|
|
return videoCnt;
|
|
}
|
|
}
|
|
@@ -491,6 +497,8 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
unitLevelOperationRecord.setCreateType(2);//项目创建
|
|
unitLevelOperationRecord.setCreateType(2);//项目创建
|
|
Integer unitCode = -1;
|
|
Integer unitCode = -1;
|
|
String errorMsg = unitParams.getString("errorMsg");
|
|
String errorMsg = unitParams.getString("errorMsg");
|
|
|
|
+ String redisKey = strategy.getAccountId() + "_" + newCampaignId + DateUtils.formatDate(new Date(), "yy-MMdd");
|
|
|
|
+ Integer redisValue = (Integer) redisUtil.get(redisKey);
|
|
if (Check.isNull(errorMsg)) {
|
|
if (Check.isNull(errorMsg)) {
|
|
log.info("创建广告组入参:{}", unitParams);
|
|
log.info("创建广告组入参:{}", unitParams);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
|
|
@@ -508,11 +516,13 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
if (unitCode != 0) {
|
|
if (unitCode != 0) {
|
|
log.error("组创建失败=>accountId:{};message:{}", accountId, errorMsg);
|
|
log.error("组创建失败=>accountId:{};message:{}", accountId, errorMsg);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
|
+ redisUtil.set(redisKey, redisValue - 1, 100000L);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
unitLevelOperationRecord.setStatus(unitCode);
|
|
unitLevelOperationRecord.setStatus(unitCode);
|
|
unitLevelOperationRecord.setMessage(errorMsg);
|
|
unitLevelOperationRecord.setMessage(errorMsg);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
unitLevelOperationRecordService.saveOrUpdate(unitLevelOperationRecord);
|
|
|
|
+ redisUtil.set(redisKey, redisValue - 1, 100000L);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1469,6 +1479,7 @@ public class AiKuaishouProjectCreateCreativeServiceImpl implements IAiKuaishouPr
|
|
} else {
|
|
} else {
|
|
count = (Integer) redisValue + 1;
|
|
count = (Integer) redisValue + 1;
|
|
redisUtil.set(redisKey, count, 100000L);
|
|
redisUtil.set(redisKey, count, 100000L);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
wildcard = wildcard + "-" + count;
|
|
wildcard = wildcard + "-" + count;
|