瀏覽代碼

定时任务添加睡眠

zhaoxian 3 年之前
父節點
當前提交
d464274313

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

@@ -359,6 +359,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
                     }
                     JSONObject unitParams = (JSONObject) result.getResult();
                     Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
+                    Thread.sleep(500);
                     unitCode = (Integer) unitCreateResult.get("code");
                     unitMessage = (String) unitCreateResult.get("message");
                     /*获取广告组创建记录*/
@@ -780,7 +781,8 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
                     JSONObject unitParams = (JSONObject) result.getResult();
 //                    log.info("--------------执行创建程序化广告组,参数:{}", unitParams);
                     Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
-//                    log.info("--------------创建程序化广告组结果,返回数据:{}", unitCreateResult.toString());
+                    Thread.sleep(500);
+                    //                    log.info("--------------创建程序化广告组结果,返回数据:{}", unitCreateResult.toString());
                     unitCode = (Integer) unitCreateResult.get("code");
                     unitMessage = (String) unitCreateResult.get("message");
 
@@ -1054,6 +1056,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             }
             JSONObject unitParams = (JSONObject) result.getResult();
             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
+            Thread.sleep(500);
             unitCode = (Integer) unitCreateResult.get("code");
             unitMessage = (String) unitCreateResult.get("message");
             Long channelId = null;
@@ -1196,6 +1199,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             }
             JSONObject unitParams = (JSONObject) result.getResult();
             Map<String, Object> unitCreateResult = kuaishouInterfaceService.adUnitCreate(token.getAccessToken(), token.getAccountId(), unitParams, 1);
+            Thread.sleep(500);
             unitCode = (Integer) unitCreateResult.get("code");
             unitMessage = (String) unitCreateResult.get("message");
             Long channelId = null;
@@ -1696,6 +1700,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
             headers.put("Access-Token", token.getAccessToken());
             String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.PROGRAM_CREATE;
             String result = HttpUtils.kuaiShouhttpPostRequest(url, creativeParams.toJSONString(), headers);
+            Thread.sleep(500);
             JSONObject resultJson = JSON.parseObject(result);
             log.info("创建程序化创意返回结果:{}", resultJson);
             if (Check.isNull(resultJson)) {
@@ -2400,6 +2405,7 @@ public class AiKuaishouAccountAutoDoServiceImpl implements IAiKuaishouAccountAut
     private boolean createCreative(CtopOauthToken token, JSONObject creativeParams, AiKuaishouAccountAutoStrategy strategy, Long newCampaignId, Long unitId, String uuid) {
         try {
             Map<String, Object> creativeCreateResult = kuaishouInterfaceService.batchCreativeCreate(token.getAccessToken(), token.getAccountId(), creativeParams, 1, null);
+            Thread.sleep(500);
             Integer creativeCode = (Integer) creativeCreateResult.get("code");
             String creativeMessage = (String) creativeCreateResult.get("message");
 

+ 5 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/hosting/service/impl/KuaishouHostingTaskServiceImpl.java

@@ -515,6 +515,11 @@ public class KuaishouHostingTaskServiceImpl extends ServiceImpl<KuaishouHostingT
         headers.put("Content-Type", "application/json");
         headers.put("Access-Token", token);
         String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
         JSONObject resultJson = JSONObject.parseObject(result);
         return resultJson;
     }

+ 1 - 0
jeecg-boot-module-system/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyServiceImpl.java

@@ -232,6 +232,7 @@ public class KuaishouAudienceReportDailyServiceImpl extends ServiceImpl<Kuaishou
                 requestJson.put("unit_ids", units);
             }
             String result = HttpUtils.kuaiShouhttpPostRequest(url, requestJson.toJSONString(), headers);
+            Thread.sleep(500);
             JSONObject resultJson = JSONObject.parseObject(result);
             if (!Check.isNull(resultJson)) {
                 Integer code = resultJson.getInteger("code");