适配新版本

This commit is contained in:
sg 2024-03-08 16:54:42 +08:00
parent 7a5a8a90df
commit 0bd8b47da0
5 changed files with 36 additions and 6 deletions

View File

@ -42,6 +42,11 @@ public class PrivateChatMsg implements Serializable {
private String signature;
private String time;
private Integer timestamp;
/**
* 对用户,如果是文件助手是filehelper
*/
private String toUser;
/**
* 类型
*/

View File

@ -15,4 +15,17 @@ import lombok.experimental.Accessors;
public class OpenHook implements SendMsg<OpenHook> {
String port;
String ip;
/**
* 0/1 1.启用http 0.不启用http
*/
boolean enableHttp;
/**
* 超时时间,单位ms
*/
String timeout;
/**
* http的请求地址enableHttp=1时不能为空
*/
String url;
}

View File

@ -18,6 +18,7 @@ import org.w3c.dom.NodeList;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.locks.ReentrantReadWriteLock;
@ -50,7 +51,12 @@ public class WxMsgHandle {
@PostConstruct
public void init() {
add(chatMsg -> {
wxSmgServer.私聊(chatMsg);
if(Objects.equals(chatMsg.getToUser(), FILEHELPER)){
wxSmgServer.文件助手(chatMsg);
}else{
wxSmgServer.私聊(chatMsg);
}
return null;
}, WxMsgType.私聊信息);
add(chatMsg -> {
@ -174,8 +180,8 @@ public class WxMsgHandle {
if (monery.startsWith("")) {
String substring = monery.substring(1);
BigDecimal decimal = new BigDecimal(substring);
log.info("收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), chatMsg.getFromUser(), remark);
wxSmgServer.收款之后(new PayoutInformation(chatMsg.getFromUser(), decimal, remark));
log.info("收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), receiver_username, remark);
wxSmgServer.收款之后(new PayoutInformation(receiver_username, decimal, remark));
return false;
};

View File

@ -32,12 +32,14 @@ public class WxSmgServerImpl implements com.example.wxhk.server.WxSmgServer {
public void 私聊(PrivateChatMsg chatMsg) {
if (Objects.equals(chatMsg.getIsSendMsg(), 1) && Objects.equals(chatMsg.getIsSendByPhone(), 1)) {
log.info("手机端对:{}发出:{}", chatMsg.getFromUser(), chatMsg.getContent());
}else{
log.info("收到私聊{}",chatMsg);
}
}
@Override
public void 文件助手(PrivateChatMsg chatMsg) {
log.info("文件助手:{}",chatMsg);
}
@Override

View File

@ -2,7 +2,8 @@ package com.example.wxhk.tcp.vertx;
import com.example.wxhk.WxhkApplication;
import com.example.wxhk.constant.WxMsgType;
import com.example.wxhk.util.HttpAsyncUtil;
import com.example.wxhk.model.request.OpenHook;
import com.example.wxhk.util.HttpSendUtil;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.DeploymentOptions;
import io.vertx.core.Future;
@ -75,7 +76,10 @@ public class VertxTcp extends AbstractVerticle implements CommandLineRunner {
listen.onComplete(event -> {
boolean succeeded = event.succeeded();
if (succeeded) {
HttpAsyncUtil.exec(HttpAsyncUtil.Type.开启hook, new JsonObject().put("port", InitWeChat.getVertxPort().toString()).put("ip", "127.0.0.1"));
HttpSendUtil.开启hook(new OpenHook().setPort(InitWeChat.getVertxPort().toString()).setIp("127.0.0.1")
.setEnableHttp(false)
.setTimeout("5000"));
// HttpAsyncUtil.exec(HttpAsyncUtil.Type.开启hook, new JsonObject().put("port", InitWeChat.getVertxPort().toString()).put("ip", "127.0.0.1"));
startPromise.complete();
} else {
startPromise.fail(event.cause());