Browse Source

、修改

yumeng 2 months ago
parent
commit
1320eee93d

+ 2 - 14
job-bytedance/pom.xml

@@ -177,7 +177,7 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
-        <dependency>
+  <!--      <dependency>
             <groupId>redis.clients</groupId>
             <artifactId>jedis</artifactId>
             <version>3.1.0</version>
@@ -186,19 +186,7 @@
             <groupId>org.redisson</groupId>
             <artifactId>redisson</artifactId>
             <version>3.36.0</version>
-        </dependency>
-        <dependency>
-            <groupId>io.netty</groupId>
-            <artifactId>netty-all</artifactId>
-            <version>4.1.33.Final</version>
-            <!-- 排除所有单独的netty模块 -->
-            <exclusions>
-                <exclusion>
-                    <groupId>io.netty</groupId>
-                    <artifactId>*</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+        </dependency>-->
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-pool2</artifactId>

+ 5 - 7
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/service/impl/BytedanceReportNewServiceImpl.java

@@ -7,7 +7,6 @@ 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,8 +21,7 @@ import java.util.*;
 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();
@@ -47,9 +45,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);
@@ -155,9 +153,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");

+ 6 - 2
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/data/utils/RateLimitUtil.java

@@ -1,3 +1,4 @@
+/*
 package cn.com.ctop.job.bytedance.data.utils;
 
 import com.google.common.collect.ImmutableMap;
@@ -37,9 +38,11 @@ public class RateLimitUtil {
             .put("/open_api/2/tools/site/get/", 10)
             .build();
 
-    /**
+    */
+/**
      * 自定义限流规则
-     */
+     *//*
+
     public boolean acquire(String devAppId, String url) {
         URI uri = URI.create(url);
         String path = uri.getPath();
@@ -59,3 +62,4 @@ public class RateLimitUtil {
         return redissonClient.getRateLimiter(key).tryAcquire(1, 1, TimeUnit.SECONDS);
     }
 }
+*/

+ 5 - 6
job-bytedance/src/main/java/cn/com/ctop/job/bytedance/utils/RedisConfig.java

@@ -1,14 +1,12 @@
+/*
 package cn.com.ctop.job.bytedance.utils;
 
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-
 import org.redisson.Redisson;
 import org.redisson.api.RedissonClient;
 import org.redisson.config.Config;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
 import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
 import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
 import org.springframework.data.redis.core.RedisTemplate;
@@ -71,3 +69,4 @@ public class RedisConfig {
         return template;
     }
 }
+*/