Browse Source

Merge branch 'V2.0.1' into test

zhaoxian 3 years ago
parent
commit
9b90a7f092

+ 10 - 8
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouAccountAutoDoServiceImpl.java

@@ -416,14 +416,14 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
     }
 
     /**
-     * 更新广告组数
+     * 更新广告组编号
      */
     private void updateVideoStatus(String key) {
         Integer unitCnt = (Integer) redisUtil.get(key);
         if (Check.isNull(unitCnt)) {
             redisUtil.set(key, 1, 100000L);
         } else {
-            redisUtil.set(key, unitCnt + 1, 100000L);
+            redisUtil.set(key, unitCnt - 1, 100000L);
         }
     }
 
@@ -1006,6 +1006,8 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
 
         //记录创建成功的素材,待最后执行删除redis
         List<AiKuaishouAccountAutoVideo> successVideoList = new ArrayList<>();
+        Integer unitCode = null;
+        String unitMessage = null;
         for (AiKuaishouAccountAutoVideo videoItem : targetsAndVideos) {
             boolean unitOverrun = getUnitOverrun(accountId);
             if (unitOverrun) {
@@ -1020,8 +1022,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
                 return 0;
             }
 
-            Integer unitCode = null;
-            String unitMessage = null;
+
             String unitName = getName(strategy.getGroupName(), strategy, videoType, videoItem.getPhotoName(), "unit", newCampaignId, videoItem.getAutoTargetId(), appId, channel);
             Result<Object> result = createUnitParams(token, newCampaignId, strategy, unitName, appId, channel, videoItem.getAutoTargetId());
             if (result.getCode() != CommonConstant.SC_OK_200) {
@@ -1068,7 +1069,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             }
         }
         removeRedisVideos(successVideoList, videoKey);
-        if (videoCnt > 0) {
+        if (videoCnt > 0 && unitCode == 0) {
             return addCustomByGroupChannel(strategy, appName, videoType, token, newCampaignId, appId, videoCnt, strategyUuid);
         }
         return videoCnt;
@@ -1132,6 +1133,8 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
 
         //记录创建成功的素材,待最后执行删除redis
         List<List<AiKuaishouAccountAutoVideo>> successVideoList = new ArrayList<>();
+        Integer unitCode = null;
+        String unitMessage = null;
         for (List<AiKuaishouAccountAutoVideo> videos : targetsAndVideos) {
             boolean unitOverrun = getUnitOverrun(accountId);
             if (unitOverrun) {
@@ -1150,8 +1153,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
                 }
             }
 
-            Integer unitCode = null;
-            String unitMessage = null;
+
             String unitName = getName(strategy.getGroupName(), strategy, videoType, null, "unit", newCampaignId, appId, videos.get(0).getAutoTargetId(), channel);
             Result<Object> result = createUnitParams(token, newCampaignId, strategy, unitName, appId, channel, videos.get(0).getAutoTargetId());
             if (result.getCode() != CommonConstant.SC_OK_200) {
@@ -1199,7 +1201,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
         }
         //删除已使用的素材
         removeProRedisVideos(successVideoList, videoKey);
-        if (videoCnt > 0) {
+        if (videoCnt > 0 && unitCode == 0) {
             return addProgramByGroupChannel(strategy, appName, videoType, token, newCampaignId, appId, videoCnt, uuid);
         }
         return videoCnt;