USVT-136 测试完整的异步消息
This commit is contained in:
parent
36c3f92e78
commit
a54b20dc35
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue