|
|
@@ -7,6 +7,7 @@ import cn.com.ctop.job.bytedance.data.mapper.AccountReportNewMapper;
|
|
|
import cn.com.ctop.job.bytedance.data.service.IBytedanceReportNewService;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.Check;
|
|
|
import cn.com.ctop.job.bytedance.data.utils.HttpUtils;
|
|
|
+import cn.com.ctop.job.bytedance.data.utils.RateLimitUtil;
|
|
|
import cn.com.ctop.job.bytedance.utils.FieldsConfig;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
@@ -22,6 +23,8 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
|
|
|
@Autowired
|
|
|
private AccountReportNewMapper accountReportNewMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RateLimitUtil rateLimitUtil;
|
|
|
|
|
|
private String urlPath = "http://192.168.0.85:8765/webhook/bytedance_account_report";
|
|
|
private static JSONArray metrics = new JSONArray();
|
|
|
@@ -45,11 +48,9 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Access-Token", accessToken);
|
|
|
String s = null;
|
|
|
- /* if (rateLimitUtil.acquire("1635316529903624", url)) {*/
|
|
|
+ if (rateLimitUtil.acquire("1635316529903624", url)) {
|
|
|
s = HttpUtils.httpGet(url, paramsMap, headers);
|
|
|
- /* }*/
|
|
|
-
|
|
|
-
|
|
|
+ }
|
|
|
JSONObject result = JSONObject.parseObject(s);
|
|
|
List<BytedanceAdvertiserReportHourly> hours = new ArrayList<>();
|
|
|
Integer code = result.getInteger("code");
|
|
|
@@ -153,9 +154,9 @@ public class BytedanceReportNewServiceImpl implements IBytedanceReportNewService
|
|
|
Map<String, String> headers = new HashMap<>();
|
|
|
headers.put("Access-Token", oauthToken);
|
|
|
String s = null;
|
|
|
- /* if (rateLimitUtil.acquire("1635316529903624", url)) {*/
|
|
|
+ if (rateLimitUtil.acquire("1635316529903624", url)) {
|
|
|
s = HttpUtils.httpGet(url, paramsMap, headers);
|
|
|
- /* }*/
|
|
|
+ }
|
|
|
JSONObject result = JSONObject.parseObject(s);
|
|
|
List<BytedanceAdvertiserReportDaily> dailies = new ArrayList<>();
|
|
|
Integer code = result.getInteger("code");
|