|
@@ -81,17 +81,19 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
|
|
|
|
public void getAd(String accountId, int pageNum, String ids, String date) {
|
|
public void getAd(String accountId, int pageNum, String ids, String date) {
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
- String[] idString = ids.split(StringUtils.COMMA);
|
|
|
|
- JSONArray getIds = new JSONArray();
|
|
|
|
- if (null != idString && idString.length > 0) {
|
|
|
|
- for (int i = 0; i < idString.length; i++) {
|
|
|
|
- Long getId = Long.parseLong(idString[i]);
|
|
|
|
- getIds.add(getId);
|
|
|
|
|
|
+ JSONArray getIds = null;
|
|
|
|
+ if (null != ids && !ids.equals("")) {
|
|
|
|
+ String[] idString = ids.split(StringUtils.COMMA);
|
|
|
|
+ if (null != idString && idString.length > 0) {
|
|
|
|
+ for (int i = 0; i < idString.length; i++) {
|
|
|
|
+ Long getId = Long.parseLong(idString[i]);
|
|
|
|
+ getIds.add(getId);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// 请求地址
|
|
// 请求地址
|
|
- String url = "https://ad.toutiao.com/open_api/2/ad/get/";
|
|
|
|
|
|
+ String url = PropertiesUtils.getValue("bytedance_config", "bytedance_api_url") + PropertiesUtils.getValue("bytedance_config", "bytedance_v2_ad_get");
|
|
// 请求参数
|
|
// 请求参数
|
|
Map<String, Object> filtering = new HashMap<>();
|
|
Map<String, Object> filtering = new HashMap<>();
|
|
if (null != getIds && getIds.size() > 0) {
|
|
if (null != getIds && getIds.size() > 0) {
|
|
@@ -106,9 +108,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
|
|
param.put("page", pageNum);
|
|
param.put("page", pageNum);
|
|
param.put("page_size", 100);
|
|
param.put("page_size", 100);
|
|
param.put("filtering", filtering);
|
|
param.put("filtering", filtering);
|
|
- log.info("查询广告计划信息参数:{}", param.toJSONString());
|
|
|
|
JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
|
|
JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
|
|
- log.info("获取公告计划信息返回数据:{}", resultObject.toJSONString());
|
|
|
|
Integer code = resultObject.getInteger("code");
|
|
Integer code = resultObject.getInteger("code");
|
|
if (null == code || !code.equals(0)) {
|
|
if (null == code || !code.equals(0)) {
|
|
log.error("获取广告计划信息接口异常==》accountId:{},message:{}", accountId, resultObject.getString("message"));
|
|
log.error("获取广告计划信息接口异常==》accountId:{},message:{}", accountId, resultObject.getString("message"));
|