1
This commit is contained in:
@@ -73,6 +73,12 @@ public class JDScheduleJob {
|
|||||||
@Value("${isRunning.jd}")
|
@Value("${isRunning.jd}")
|
||||||
private String isRunning_jd;
|
private String isRunning_jd;
|
||||||
|
|
||||||
|
@Value("${jarvis.server.comment.base-url:http://192.168.8.6:5000}")
|
||||||
|
private String commentBaseUrl;
|
||||||
|
|
||||||
|
@Value("${jarvis.server.comment.fetch-path:/fetch_comments}")
|
||||||
|
private String commentFetchPath;
|
||||||
|
|
||||||
// 构造函数中注入StringRedisTemplate
|
// 构造函数中注入StringRedisTemplate
|
||||||
@Autowired
|
@Autowired
|
||||||
public JDScheduleJob(WXUtil wxUtil, StringRedisTemplate redisTemplate, OrderRowRepository orderRowRepository, OrderUtil orderUtil, JDUtil jdUtil, CommentRepository commentRepository) {
|
public JDScheduleJob(WXUtil wxUtil, StringRedisTemplate redisTemplate, OrderRowRepository orderRowRepository, OrderUtil orderUtil, JDUtil jdUtil, CommentRepository commentRepository) {
|
||||||
@@ -516,7 +522,7 @@ public class JDScheduleJob {
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String fetchUrl = "http://192.168.8.6:5000/fetch_comments?product_id=" + product_id;
|
String fetchUrl = commentBaseUrl + commentFetchPath + "?product_id=" + product_id;
|
||||||
// 用hutool发起post请求
|
// 用hutool发起post请求
|
||||||
HttpResponse response = HttpRequest.post(fetchUrl).timeout(60000).execute();
|
HttpResponse response = HttpRequest.post(fetchUrl).timeout(60000).execute();
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -146,6 +147,12 @@ public class JDUtil {
|
|||||||
|
|
||||||
final WXUtil wxUtil;
|
final WXUtil wxUtil;
|
||||||
private final StringRedisTemplate redisTemplate;
|
private final StringRedisTemplate redisTemplate;
|
||||||
|
|
||||||
|
@Value("${jarvis.server.comment.base-url:http://192.168.8.6:5000}")
|
||||||
|
private String commentBaseUrl;
|
||||||
|
|
||||||
|
@Value("${jarvis.server.comment.fetch-path:/fetch_comments}")
|
||||||
|
private String commentFetchPath;
|
||||||
private final OrderRowRepository orderRowRepository;
|
private final OrderRowRepository orderRowRepository;
|
||||||
private final CommentRepository commentRepository;
|
private final CommentRepository commentRepository;
|
||||||
private final JDOrderRepository jdOrderRepository;
|
private final JDOrderRepository jdOrderRepository;
|
||||||
@@ -2230,7 +2237,7 @@ public class JDUtil {
|
|||||||
*/
|
*/
|
||||||
if (!isTb) {
|
if (!isTb) {
|
||||||
try {
|
try {
|
||||||
String fetchUrl = "http://192.168.8.6:5000/fetch_comments?product_id=" + product_id;
|
String fetchUrl = commentBaseUrl + commentFetchPath + "?product_id=" + product_id;
|
||||||
HttpResponse response = HttpRequest.post(fetchUrl).timeout(1000 * 60).execute();
|
HttpResponse response = HttpRequest.post(fetchUrl).timeout(1000 * 60).execute();
|
||||||
|
|
||||||
logger.info("fetchUrl: {}", fetchUrl);
|
logger.info("fetchUrl: {}", fetchUrl);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -21,6 +22,8 @@ public class WxtsUtil {
|
|||||||
public static final String TOKEN = "super_token_b62190c26";
|
public static final String TOKEN = "super_token_b62190c26";
|
||||||
private static final String SERVER_URL = "https://wxts.van333.cn";
|
private static final String SERVER_URL = "https://wxts.van333.cn";
|
||||||
|
|
||||||
|
@Value("${jarvis.server.host:127.0.0.1}")
|
||||||
|
private String serverHost;
|
||||||
|
|
||||||
public void sendNotify(String content) {
|
public void sendNotify(String content) {
|
||||||
try {
|
try {
|
||||||
@@ -28,7 +31,7 @@ public class WxtsUtil {
|
|||||||
HashMap<String, Object> paramMap = new HashMap<>();
|
HashMap<String, Object> paramMap = new HashMap<>();
|
||||||
paramMap.put("title", "JD机器人微信推送");
|
paramMap.put("title", "JD机器人微信推送");
|
||||||
content = content.replaceAll("\\n", "<br>");
|
content = content.replaceAll("\\n", "<br>");
|
||||||
String common = "192.168.8.88 (微信机器人), 信息 : ";
|
String common = serverHost + " (微信机器人), 信息 : ";
|
||||||
content = common + content + "<br><br>";
|
content = common + content + "<br><br>";
|
||||||
paramMap.put("text", content);
|
paramMap.put("text", content);
|
||||||
HttpRequest.post(url).header("vanToken", TOKEN).header("source", "XZJ_UBUNTU").body(JSON.toJSONString(paramMap)).execute();
|
HttpRequest.post(url).header("vanToken", TOKEN).header("source", "XZJ_UBUNTU").body(JSON.toJSONString(paramMap)).execute();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import cn.hutool.http.HttpResponse;
|
|||||||
import cn.hutool.http.Method;
|
import cn.hutool.http.Method;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -28,8 +29,12 @@ public class GPTClientUtil {
|
|||||||
private static final String GPT_API_URL = "https://api.openai.com/v1/chat/completions"; // GPT API 地址
|
private static final String GPT_API_URL = "https://api.openai.com/v1/chat/completions"; // GPT API 地址
|
||||||
private static final String GPT_API_KEY = "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"; // 替换为你的 GPT API 密钥
|
private static final String GPT_API_KEY = "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"; // 替换为你的 GPT API 密钥
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper(); // Jackson JSON 解析器
|
private static final ObjectMapper objectMapper = new ObjectMapper(); // Jackson JSON 解析器
|
||||||
private static final String PROXY_HOST = "192.168.8.9"; // 本地代理地址
|
|
||||||
private static final int PROXY_PORT = 1070; // 本地代理端口
|
@Value("${jarvis.server.proxy.host:192.168.8.9}")
|
||||||
|
private String proxyHost; // 代理地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
|
||||||
|
@Value("${jarvis.server.proxy.port:1070}")
|
||||||
|
private int proxyPort; // 代理端口
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用 GPT API 并返回第一次回复的文本内容
|
* 调用 GPT API 并返回第一次回复的文本内容
|
||||||
@@ -59,7 +64,7 @@ public class GPTClientUtil {
|
|||||||
String jsonBody = objectMapper.writeValueAsString(requestBody);
|
String jsonBody = objectMapper.writeValueAsString(requestBody);
|
||||||
|
|
||||||
// 3. 使用 Hutool HTTP 发送请求,设置代理
|
// 3. 使用 Hutool HTTP 发送请求,设置代理
|
||||||
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(PROXY_HOST, PROXY_PORT));
|
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
|
||||||
HttpRequest request = HttpRequest.of(GPT_API_URL)
|
HttpRequest request = HttpRequest.of(GPT_API_URL)
|
||||||
.method(Method.POST)
|
.method(Method.POST)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
|
|||||||
@@ -49,11 +49,35 @@ logging:
|
|||||||
level:
|
level:
|
||||||
cn.van: debug
|
cn.van: debug
|
||||||
org.springframework: warn
|
org.springframework: warn
|
||||||
|
# 服务地址配置(用于服务器迁移)
|
||||||
|
jarvis:
|
||||||
|
# 服务器基础地址(如果所有服务都在同一台服务器,可以使用127.0.0.1)
|
||||||
|
# 开发环境:根据实际情况配置
|
||||||
|
server:
|
||||||
|
host: 192.168.8.88
|
||||||
|
# RocketMQ Name Server地址
|
||||||
|
rocketmq:
|
||||||
|
name-server: 192.168.8.88:39876
|
||||||
|
# 微信机器人服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
wx:
|
||||||
|
base-url: http://192.168.8.6:7777
|
||||||
|
api-path: /qianxun/httpapi
|
||||||
|
# 评论接口服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
comment:
|
||||||
|
base-url: http://192.168.8.6:5000
|
||||||
|
fetch-path: /fetch_comments
|
||||||
|
# 青龙面板服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
qinglong:
|
||||||
|
base-url: http://134.175.126.60:35700
|
||||||
|
# 代理服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
proxy:
|
||||||
|
host: 192.168.8.9
|
||||||
|
port: 1070
|
||||||
config:
|
config:
|
||||||
WX_BASE_URL: http://192.168.8.6:7777/qianxun/httpapi?wxid=wxid_kr145nk7l0an31
|
WX_BASE_URL: http://192.168.8.6:7777/qianxun/httpapi?wxid=wxid_kr145nk7l0an31
|
||||||
QL_BASE_URL: http://134.175.126.60:35700
|
QL_BASE_URL: http://134.175.126.60:35700
|
||||||
rocketmq:
|
rocketmq:
|
||||||
name-server: 192.168.8.88:39876 # RocketMQ Name Server 地址
|
name-server: ${jarvis.server.rocketmq.name-server} # RocketMQ Name Server 地址
|
||||||
producer:
|
producer:
|
||||||
group: wx_producer # 生产者组名
|
group: wx_producer # 生产者组名
|
||||||
send-msg-timeout: 1000 # 发送消息超时时间
|
send-msg-timeout: 1000 # 发送消息超时时间
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ spring:
|
|||||||
#数据源配置
|
#数据源配置
|
||||||
datasource:
|
datasource:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://192.168.8.88:3306/jd?characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://${jarvis.server.host}:3306/jd?characterEncoding=utf-8&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: mysql_7sjTXH
|
password: mysql_7sjTXH
|
||||||
hikari:
|
hikari:
|
||||||
@@ -38,7 +38,7 @@ spring:
|
|||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
data:
|
data:
|
||||||
redis:
|
redis:
|
||||||
host: 192.168.8.88
|
host: ${jarvis.server.host}
|
||||||
password: redis_6PZ52S
|
password: redis_6PZ52S
|
||||||
timeout: 1800000
|
timeout: 1800000
|
||||||
port: 6379
|
port: 6379
|
||||||
@@ -49,11 +49,35 @@ logging:
|
|||||||
level:
|
level:
|
||||||
cn.van: debug
|
cn.van: debug
|
||||||
org.springframework: warn
|
org.springframework: warn
|
||||||
|
# 服务地址配置(用于服务器迁移)
|
||||||
|
jarvis:
|
||||||
|
# 服务器基础地址(如果所有服务都在同一台服务器,可以使用127.0.0.1)
|
||||||
|
# 生产环境:192.168.8.88 或 127.0.0.1
|
||||||
|
server:
|
||||||
|
host: 127.0.0.1
|
||||||
|
# RocketMQ Name Server地址
|
||||||
|
rocketmq:
|
||||||
|
name-server: 127.0.0.1:9876
|
||||||
|
# 微信机器人服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
wx:
|
||||||
|
base-url: http://192.168.8.6:7777
|
||||||
|
api-path: /qianxun/httpapi
|
||||||
|
# 评论接口服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
comment:
|
||||||
|
base-url: http://192.168.8.6:5000
|
||||||
|
fetch-path: /fetch_comments
|
||||||
|
# 青龙面板服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
qinglong:
|
||||||
|
base-url: http://134.175.126.60:35700
|
||||||
|
# 代理服务地址(注意:此服务不在同一台服务器,需要单独配置)
|
||||||
|
proxy:
|
||||||
|
host: 192.168.8.9
|
||||||
|
port: 1070
|
||||||
config:
|
config:
|
||||||
WX_BASE_URL: http://192.168.8.6:7777/qianxun/httpapi?wxid=wxid_cfmrk2upjtf322 #wxid_kr145nk7l0an31大号
|
WX_BASE_URL: http://192.168.8.6:7777/qianxun/httpapi?wxid=wxid_cfmrk2upjtf322 #wxid_kr145nk7l0an31大号
|
||||||
QL_BASE_URL: http://134.175.126.60:35700
|
QL_BASE_URL: http://134.175.126.60:35700
|
||||||
rocketmq:
|
rocketmq:
|
||||||
name-server: 192.168.8.88:9876 # RocketMQ Name Server 地址
|
name-server: ${jarvis.server.rocketmq.name-server} # RocketMQ Name Server 地址
|
||||||
producer:
|
producer:
|
||||||
group: wx_producer # 生产者组名
|
group: wx_producer # 生产者组名
|
||||||
send-msg-timeout: 1000 # 发送消息超时时间
|
send-msg-timeout: 1000 # 发送消息超时时间
|
||||||
|
|||||||
@@ -57,8 +57,14 @@ logging:
|
|||||||
org.springframework.web: WARN
|
org.springframework.web: WARN
|
||||||
org.apache.http: WARN
|
org.apache.http: WARN
|
||||||
com.zaxxer.hikari: ERROR
|
com.zaxxer.hikari: ERROR
|
||||||
|
# 服务地址配置(用于服务器迁移)
|
||||||
|
jarvis:
|
||||||
|
server:
|
||||||
|
host: 192.168.8.88
|
||||||
|
rocketmq:
|
||||||
|
name-server: 192.168.8.88:9876
|
||||||
rocketmq:
|
rocketmq:
|
||||||
name-server: 192.168.8.88:9876 # RocketMQ Name Server 地址
|
name-server: ${jarvis.server.rocketmq.name-server:192.168.8.88:9876} # RocketMQ Name Server 地址
|
||||||
producer:
|
producer:
|
||||||
group: wx_producer # 生产者组名
|
group: wx_producer # 生产者组名
|
||||||
send-msg-timeout: 1000 # 发送消息超时时间
|
send-msg-timeout: 1000 # 发送消息超时时间
|
||||||
|
|||||||
Reference in New Issue
Block a user