From a54b20dc35d7cbf92b35d95d15587c5589422f03 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Sat, 18 Feb 2023 06:20:09 -0500 Subject: [PATCH] =?UTF-8?q?USVT-136=20=E6=B5=8B=E8=AF=95=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E6=AD=A5=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/ChatGPTService.java | 7 +++---- .../api/service/impl/WeChatService.java | 17 +++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/northtecom/visatrack/api/service/impl/ChatGPTService.java b/src/main/java/com/northtecom/visatrack/api/service/impl/ChatGPTService.java index fee087b..6746306 100644 --- a/src/main/java/com/northtecom/visatrack/api/service/impl/ChatGPTService.java +++ b/src/main/java/com/northtecom/visatrack/api/service/impl/ChatGPTService.java @@ -57,7 +57,7 @@ public class ChatGPTService { } @Async - public String processChatGPTContent(String weChatMessageXmlStr) { + public void processChatGPTContent(String weChatMessageXmlStr) { WeChatMessage weChatMessage = WeChatUtils.covertToWeChatMessage(weChatMessageXmlStr); String toUserName = weChatMessage.getFromUserName(); String fromUserName = weChatMessage.getToUserName(); @@ -91,13 +91,12 @@ public class ChatGPTService { weChatMessage.setCreateTime(Instant.now().toEpochMilli()); try { - weChatService.sendMessage(toUserName); + weChatService.sendMessage(weChatMessage); } catch (WxErrorException e) { throw new RuntimeException(e); } - - return WeChatUtils.covertToWeChatMessageXmlStr(weChatMessage); +// return WeChatUtils.covertToWeChatMessageXmlStr(weChatMessage); } diff --git a/src/main/java/com/northtecom/visatrack/api/service/impl/WeChatService.java b/src/main/java/com/northtecom/visatrack/api/service/impl/WeChatService.java index ffbab59..fe5603f 100644 --- a/src/main/java/com/northtecom/visatrack/api/service/impl/WeChatService.java +++ b/src/main/java/com/northtecom/visatrack/api/service/impl/WeChatService.java @@ -152,6 +152,7 @@ public class WeChatService { return Boolean.FALSE; } + @Deprecated public String getWeChatMessage(String weChatMessageXmlStr) { WeChatMessage weChatMessage = WeChatUtils.covertToWeChatMessage(weChatMessageXmlStr); String toUserName = weChatMessage.getFromUserName(); @@ -179,11 +180,11 @@ public class WeChatService { future.cancel(true); // may or may not desire this } - try { - sendMessage(toUserName); - } catch (WxErrorException e) { - throw new RuntimeException(e); - } +// try { +// sendMessage(toUserName); +// } catch (WxErrorException e) { +// throw new RuntimeException(e); +// } // weChatMessage.setToUserName(toUserName); // weChatMessage.setFromUserName(fromUserName); @@ -194,11 +195,11 @@ public class WeChatService { } @Async - public void sendMessage(String toUserName) throws WxErrorException { + public void sendMessage(WeChatMessage weChatMessage) throws WxErrorException { - CustomMessage.KfText kfText = new CustomMessage.KfText("xxx"); + CustomMessage.KfText kfText = new CustomMessage.KfText(weChatMessage.getContent()); CustomMessage customMessage = new CustomMessage(); - customMessage.setToUser(toUserName); + customMessage.setToUser(weChatMessage.getToUserName()); customMessage.setMsgType("text"); customMessage.setText(kfText);