yumeng 3 роки тому
батько
коміт
d6a9b571fa

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/IAiKuaishouCreateCreativeService.java

@@ -5,11 +5,11 @@ import cn.com.ctop.kuaishou.modules.ai.entity.AiKuaishouAdvertiserStrategy;
 import java.text.ParseException;
 
 public interface IAiKuaishouCreateCreativeService {
-    Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt,String startTime,String endTime);
+    Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt,String startTime,String endTime) throws InterruptedException;
 
     void autoCreateProgramCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt);
 
-    void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException;
+    void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException, InterruptedException;
 
     void customCreativeLimit(AiKuaishouAdvertiserStrategy strategy);
 

+ 4 - 3
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/ai/service/impl/AiKuaishouCreateCreativeServiceImpl.java

@@ -82,7 +82,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
      * @param videoCnt   视频数量
      */
     @Override
-    public Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt, String startTime, String endTime) {
+    public Long autoCreateCreative(AiKuaishouAdvertiserStrategy strategy, Integer createType, Long videoCnt, String startTime, String endTime) throws InterruptedException {
         String strategyUuid = UUID.randomUUID().toString();
         strategy.setUnitType(4);
         Long accountId = strategy.getAccountId();
@@ -756,7 +756,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
     }
 
     @Override
-    public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException {
+    public void customCreativeSupplement(AiKuaishouAdvertiserStrategy strategy, Integer hour) throws ParseException, InterruptedException {
         Long customUnitCnt = strategy.getCustomUnitCnt();
         if (Check.isNull(customUnitCnt)) {
             Integer imageCnt = strategy.getImageCnt();
@@ -1579,7 +1579,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
 
     private void createCreativeByImage(List<MaterialCutFrame> cutFrameList, CtopOauthToken token, JSONObject creativeParams,
                                        Long campaignId, Long unitId, KuaiShouVideoGet videoItem,
-                                       int imageNumber, AiKuaishouAdvertiserStrategy strategy, String uuid, String appVersion) {
+                                       int imageNumber, AiKuaishouAdvertiserStrategy strategy, String uuid, String appVersion) throws InterruptedException {
         if ((null != cutFrameList && !cutFrameList.isEmpty())) {
             for (int i = 0; i < cutFrameList.size(); i++) {
                 String imageCode = cutFrameList.get(i).getSignature();
@@ -1587,6 +1587,7 @@ public class AiKuaishouCreateCreativeServiceImpl implements IAiKuaishouCreateCre
                 String imageToken = getImageToken(imageUrl, imageCode, token.getAccountId(), token.getAccessToken());
                 creativeParams.put("image_token", imageToken);
                 createCreative(token, creativeParams, campaignId, unitId, i + 1, videoItem, strategy, uuid, appVersion);
+                Thread.sleep(200L);
                 imageNumber--;
                 if (imageNumber <= 0) {
                     break;