Merge remote-tracking branch '群晖/master'
This commit is contained in:
@@ -1932,7 +1932,7 @@ public class JDUtil {
|
||||
try {
|
||||
String fetchUrl = "http://192.168.8.6:5000/fetch_comments?product_id=" + product_id;
|
||||
// 用hutool发起post请求
|
||||
HttpResponse response = HttpRequest.post(fetchUrl).timeout(60000).execute();
|
||||
HttpResponse response = HttpRequest.post(fetchUrl).timeout(1000 * 60).execute();
|
||||
|
||||
logger.info("fetchUrl: {}", fetchUrl);
|
||||
// code = 200 表示成功,-200 表示失败
|
||||
@@ -1946,18 +1946,20 @@ public class JDUtil {
|
||||
commentToUse = availableComments.get(0);
|
||||
}
|
||||
} else if (response.getStatus() == -200) {
|
||||
wxUtil.sendTextMessage(fromWxid, "暂时无法获取新的评论,请稍后再试", 1, fromWxid, false);
|
||||
return;
|
||||
wxUtil.sendTextMessage(fromWxid, "请求响应:暂无新的评论。为您随机选取使用过的评论", 1, fromWxid, false);
|
||||
// 随机选取一个使用过的评论
|
||||
Collections.shuffle(usedComments);
|
||||
commentToUse = usedComments.get(0);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("调用外部接口获取评论失败", e);
|
||||
wxUtil.sendTextMessage(fromWxid, "调用外部接口获取评论失败", 1, fromWxid, false);
|
||||
return;
|
||||
wxUtil.sendTextMessage(fromWxid, "请求响应:响应超时(60s)。为您随机选取使用过的评论", 1, fromWxid, false);
|
||||
commentToUse = usedComments.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
if (commentToUse == null) {
|
||||
wxUtil.sendTextMessage(fromWxid, "没有找到可用的评论数据", 1, fromWxid, false);
|
||||
wxUtil.sendTextMessage(fromWxid, "本地和京东均无可用的评论数据,请检查sku", 1, fromWxid, false);
|
||||
return;
|
||||
}
|
||||
wxUtil.sendTextMessage(fromWxid, commentToUse.getCommentText(), 1, fromWxid, true);
|
||||
|
||||
Reference in New Issue
Block a user