zhiqiang.lv hai 1 mes
pai
achega
8a2a54245f

+ 3 - 4
src/main/java/top/lvzhiqiang/service/impl/AbstractPlaywrightService.java

@@ -292,7 +292,7 @@ public abstract class AbstractPlaywrightService implements ScraperService {
             Map<String, List<String>> map = connection.getHeaderFields();
             // 遍历所有的响应头字段
             for (String key : map.keySet()) {
-                System.err.println(key + "--->" + map.get(key));
+                //System.err.println(key + "--->" + map.get(key));
             }
             // 定义 BufferedReader输入流来读取URL的响应
             BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
@@ -304,13 +304,12 @@ public abstract class AbstractPlaywrightService implements ScraperService {
             /**
              * 返回结果示例
              */
-            System.err.println("result:" + result);
+            //System.err.println("result:" + result);
             JSONObject jsonObject = JSONObject.parseObject(result);
             String access_token = jsonObject.getString("access_token");
             return access_token;
         } catch (Exception e) {
-            System.err.print("获取token失败!");
-            e.printStackTrace(System.err);
+            log.error("获取token失败!", e);
         }
         return null;
     }

+ 22 - 22
src/main/java/top/lvzhiqiang/service/impl/SubscribeServiceImpl.java

@@ -1,28 +1,8 @@
 package top.lvzhiqiang.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.zaxxer.hikari.HikariDataSource;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.stereotype.Service;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.Yaml;
-import top.lvzhiqiang.entity.NetAccount;
-import top.lvzhiqiang.entity.NetNode;
-import top.lvzhiqiang.exception.BusinessException;
-import top.lvzhiqiang.mapper.NetMapper;
-import top.lvzhiqiang.service.SubscribeService;
-import top.lvzhiqiang.util.StringUtils;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.sql.Connection;
-import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -38,6 +18,25 @@ import java.util.Map;
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.stereotype.Service;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.Yaml;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.zaxxer.hikari.HikariDataSource;
+
+import lombok.extern.slf4j.Slf4j;
+import top.lvzhiqiang.entity.NetAccount;
+import top.lvzhiqiang.entity.NetNode;
+import top.lvzhiqiang.exception.BusinessException;
+import top.lvzhiqiang.mapper.NetMapper;
+import top.lvzhiqiang.service.SubscribeService;
+import top.lvzhiqiang.util.StringUtils;
+
 @Service
 @Slf4j
 public class SubscribeServiceImpl implements SubscribeService {
@@ -67,7 +66,7 @@ public class SubscribeServiceImpl implements SubscribeService {
      */
     @PostConstruct
     public void init() {
-        System.out.println("正在初始化 Service 私有的连接池...");
+        log.info("正在初始化 Service 私有的连接池...");
 
         privateDataSource = new HikariDataSource();
         privateDataSource.setJdbcUrl(url);
@@ -89,7 +88,8 @@ public class SubscribeServiceImpl implements SubscribeService {
     @PreDestroy
     public void cleanup() {
         if (privateDataSource != null && !privateDataSource.isClosed()) {
-            System.out.println("正在关闭 Service 私有的连接池...");
+            log.info("正在关闭 Service 私有的连接池...");
+            
             privateDataSource.close();
         }
     }