From 76a2fa0dc10e69505e35d884b8e7f6b682cebbec Mon Sep 17 00:00:00 2001 From: Allen Date: Fri, 14 Sep 2018 10:49:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81:?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8F=91=E9=80=81=E6=96=87=E6=9C=AC=E6=B6=88?= =?UTF-8?q?=E6=81=AF=EF=BC=88=E6=A0=B9=E6=8D=AE=E5=A4=9A=E7=A7=8D=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=EF=BC=89=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/hotlcc/wechat4j/Wechat.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/main/java/com/hotlcc/wechat4j/Wechat.java b/src/main/java/com/hotlcc/wechat4j/Wechat.java index d03860c..95ed37b 100644 --- a/src/main/java/com/hotlcc/wechat4j/Wechat.java +++ b/src/main/java/com/hotlcc/wechat4j/Wechat.java @@ -1178,6 +1178,39 @@ public class Wechat { return sendText(content, userName); } + /** + * 发送文本消息(根据多种名称) + * + * @param content + * @param userName + * @param nickName + * @param remarkName + * @return + */ + public JSONObject sendText(String content, String userName, String nickName, String remarkName) { + UserInfo userInfo = null; + + if (StringUtil.isNotEmpty(userName)) { + return sendText(content, userName); + } else if (StringUtil.isNotEmpty(nickName)) { + userInfo = getContactByNickName(false, nickName); + } else if (StringUtil.isNotEmpty(remarkName)) { + userInfo = getContactByRemarkName(false, remarkName); + } else { + String loginUserName = getLoginUserName(false); + return sendText(content, loginUserName); + } + + if (userInfo == null) { + return null; + } + userName = userInfo.getUserName(); + if (StringUtil.isEmpty(userName)) { + return null; + } + return sendText(content, userName); + } + //TODO 待完成 @Deprecated public JSONObject sendImage(File image, String userName) { From 0c6356a71a389ef9bd1f1e2022b02d0652646f43 Mon Sep 17 00:00:00 2001 From: Allen Date: Fri, 14 Sep 2018 10:50:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81:?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC=E5=8F=B7[0.1.1->0.1.2]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9faeb0b..3baf1ab 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.hotlcc wechat4j - 0.1.1 + 0.1.2 wechat4j Wechat client for Java.