|
@@ -792,7 +792,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
|
|
|
//获取创意参数
|
|
|
JSONObject creativeParams = getProgramCreativeParams(token, unitId, videos, strategy, videoCnt, null, usedchannel);
|
|
|
//执行创建创意
|
|
|
- boolean flag = createProgramCreatives(token, creativeParams, strategy);
|
|
|
+ boolean flag = createProgramCreatives(token, creativeParams, strategy, 1);
|
|
|
if (flag) {
|
|
|
//创意成功,则素材置为不可用,添加素材使用记录
|
|
|
updateVideoUsed(videoType, videos, "program", null);
|
|
@@ -955,7 +955,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
|
|
|
//获取创意参数
|
|
|
JSONObject creativeParams = getProgramCreativeParams(token, unitId, videos, strategy, videoCnt, videos.get(0).getAppVersion(), null);
|
|
|
//执行创建创意
|
|
|
- createProgramCreatives(token, creativeParams, strategy);
|
|
|
+ createProgramCreatives(token, creativeParams, strategy, 1);
|
|
|
if (videoCnt <= 0) {
|
|
|
removeProRedisVideos(successVideoList, videoKey);
|
|
|
return 0;
|
|
@@ -1184,7 +1184,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
|
|
|
//获取创意参数
|
|
|
JSONObject creativeParams = getProgramCreativeParams(token, unitId, videos, strategy, videoCnt, null, channel);
|
|
|
//执行创建创意
|
|
|
- boolean flag = createProgramCreatives(token, creativeParams, strategy);
|
|
|
+ boolean flag = createProgramCreatives(token, creativeParams, strategy, 1);
|
|
|
if (flag) {
|
|
|
successVideoList.add(videos);
|
|
|
//创意成功,则素材置为不可用,添加素材使用记录
|
|
@@ -1643,7 +1643,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
|
|
|
/**
|
|
|
* 执行创建程序化创意
|
|
|
*/
|
|
|
- private boolean createProgramCreatives(CtopOauthToken token, JSONObject creativeParams, AiKuaishouAccountAutoStrategy strategy) {
|
|
|
+ private boolean createProgramCreatives(CtopOauthToken token, JSONObject creativeParams, AiKuaishouAccountAutoStrategy strategy, int count) {
|
|
|
try {
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Content-Type", "application/json");
|
|
@@ -1662,13 +1662,18 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
|
|
|
if (code == 0) {
|
|
|
createLandPageAndUnit(creativeParams, resultJson.getJSONObject("data"));
|
|
|
} else {
|
|
|
- log.error("快手创建程序化创意失败,accountId:{},unitId:{},返回信息:{},入参:{}", token.getAccountId(), unitId, message,creativeParams.toJSONString());
|
|
|
- if (code == 400001 && "/rest/openapi/v2/creative/advanced/program/create调用已超日限,次日可恢复调用".equals(message)) {
|
|
|
+ log.error("快手创建程序化创意失败,accountId:{},unitId:{},返回信息:{},入参:{}", token.getAccountId(), unitId, message, creativeParams.toJSONString());
|
|
|
+ if ("系统错误".equals(message) && count <= 3) {
|
|
|
+ log.info("第{}次重新创建程序化创意", count);
|
|
|
+ //系统错误,则重新执行
|
|
|
+ return createProgramCreatives(token, creativeParams, strategy, count + 1);
|
|
|
+ } else if (code == 400001 && "/rest/openapi/v2/creative/advanced/program/create调用已超日限,次日可恢复调用".equals(message)) {
|
|
|
String statDate = DateUtils.formatDate(new Date());
|
|
|
String programKey = token.getAccountId() + "_pcreativecount_" + statDate;
|
|
|
redisUtil.set(programKey, 1, 100000L);
|
|
|
updateService.updateUnitStatus(token.getAccessToken(), token.getAccountId(), unitId, 3, "e9ca23d68d884d4ebb19d07889727dae");
|
|
|
}
|
|
|
+
|
|
|
return false;
|
|
|
}
|
|
|
} catch (Exception e) {
|