فهرست منبع

promotion list 超过1万拉取修改

hpk 1 سال پیش
والد
کامیت
d50d8d2674

+ 8 - 6
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceCdpProjectServiceImpl.java

@@ -92,7 +92,8 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
     private void getPromotionListVo(Long advertiserId, JSONArray ids, String date, Integer page, Long cursor, int count, Long errorId, Integer isLog) {
         try {
             log.info("执行id:{}", advertiserId);
-            boolean nextPage = false;
+            boolean hasNextPage = false;
+            Integer nextPage = null;
             Long nextCursor = null;
             String accessToken = tokenMapper.onlyGetToken(advertiserId);
             if (Check.isNull(accessToken)) {
@@ -126,14 +127,15 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
                     JSONObject data = obj.getJSONObject("data");
                     if (cursor != null) {
                         JSONObject cursorInfo = data.getJSONObject("cursor_info");
-                        nextPage = cursorInfo.getBoolean("has_more");
-                        if (nextPage) {
+                        hasNextPage = cursorInfo.getBoolean("has_more");
+                        if (hasNextPage) {
                             nextCursor = cursorInfo.getLong("cursor");
                         }
                     } else {
                         Integer totalPage = data.getJSONObject("page_info").getInteger("total_page");
                         if (totalPage != 0 && totalPage > data.getJSONObject("page_info").getInteger("page")) {
-                            nextPage = true;
+                            hasNextPage = true;
+                            nextPage = page + 1;
                         }
                     }
                     JSONArray array = data.getJSONArray("list");
@@ -161,8 +163,8 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
                     return;
                 }
             }
-            if (nextPage) {
-                getPromotionListVo(advertiserId, ids, date, page + 1, nextCursor, 1, errorId, isLog);
+            if (hasNextPage) {
+                getPromotionListVo(advertiserId, ids, date, nextPage, nextCursor, 1, errorId, isLog);
             } else if (errorId != null) {
                 promoterReportMapper.deleteInfoByErrorId(errorId);
             }