|
|
@@ -12,10 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.time.Instant;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 头条项目列Service业务层处理
|
|
|
@@ -53,7 +50,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Long> queryPageAdvertiserIds() {
|
|
|
+ public List<JSONObject> queryPageAdvertiserIds() {
|
|
|
return bytedanceCdpProjectMapper.queryPageAdvertiserIds();
|
|
|
}
|
|
|
|
|
|
@@ -532,14 +529,14 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void getAdqWechatPages(Long advertiserId) {
|
|
|
+ public void getAdqWechatPages(Long advertiserId,Long pageId) {
|
|
|
try {
|
|
|
String accessToken = tokenMapper.onlyGetADQToken(advertiserId);
|
|
|
if (Check.isNull(accessToken)) {
|
|
|
log.error("账户({})accessToken is null", advertiserId);
|
|
|
return;
|
|
|
}
|
|
|
- this.getAdqWechatPagesVo(advertiserId, accessToken, 1, true, 1);
|
|
|
+ this.getAdqWechatPagesVo(advertiserId,pageId, accessToken, 1, true, 1);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
log.error("账户({})获取原生落地页异常", e.getMessage());
|
|
|
@@ -547,7 +544,7 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void getAdqWechatPagesVo(Long accountId, String accessToken, Integer page, Boolean isDeleted, int count) throws Exception {
|
|
|
+ private void getAdqWechatPagesVo(Long accountId,Long pageId, String accessToken, Integer page, Boolean isDeleted, int count) throws Exception {
|
|
|
boolean nextPage = false;
|
|
|
JSONObject returnJson = new JSONObject();
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
@@ -563,9 +560,15 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
greObj.put("field", "page_type");
|
|
|
greObj.put("operator", "EQUALS");
|
|
|
greObj.put("values", "PAGE_TYPE_WECHAT_CANVAS");
|
|
|
+
|
|
|
+ JSONObject pageFilter = new JSONObject();
|
|
|
+ pageFilter.put("field", "page_id");
|
|
|
+ pageFilter.put("operator", "EQUALS");
|
|
|
+ pageFilter.put("values", Collections.singletonList(String.valueOf(pageId)));
|
|
|
filtering.add(greObj);
|
|
|
+ filtering.add(pageFilter);
|
|
|
|
|
|
-// param.put("filtering", filtering);
|
|
|
+ param.put("filtering", filtering);
|
|
|
String result = HttpUtils.httpGet("https://api.e.qq.com/v3.0/wechat_pages/get", param, new HashMap<>());
|
|
|
JSONObject obj = JSONObject.parseObject(result);
|
|
|
if (!Check.isNull(obj)) {
|
|
|
@@ -596,14 +599,14 @@ public class BytedanceCdpProjectServiceImpl implements IBytedanceCdpProjectServi
|
|
|
} else {
|
|
|
if (count <= 4) {
|
|
|
Thread.sleep(500);
|
|
|
- getAdqWechatPagesVo(accountId, accessToken, page, isDeleted, count + 1);
|
|
|
+ getAdqWechatPagesVo(accountId,pageId, accessToken, page, isDeleted, count + 1);
|
|
|
} else {
|
|
|
log.error("账户({})获取动态创意失败,入参:{}\n,结果:{}", accountId, JSONObject.toJSONString(param), obj);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (nextPage) {
|
|
|
- getAdqWechatPagesVo(accountId, accessToken, page + 1, isDeleted, 1);
|
|
|
+ getAdqWechatPagesVo(accountId,pageId, accessToken, page + 1, isDeleted, 1);
|
|
|
}
|
|
|
}
|
|
|
|