From 743d40c847ec56049d59e72ec5bc1ae1e8fdc12c Mon Sep 17 00:00:00 2001 From: Allen Date: Wed, 19 Sep 2018 16:57:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81:?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8F=82=E6=95=B0=E4=BD=8D=E7=BD=AE=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E7=9A=84=E9=AA=8C=E8=AF=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/hotlcc/wechat4j/Wechat.java | 14 +++++++------- src/test/java/TestClass.java | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/hotlcc/wechat4j/Wechat.java b/src/main/java/com/hotlcc/wechat4j/Wechat.java index aa5a681..bd7e0eb 100644 --- a/src/main/java/com/hotlcc/wechat4j/Wechat.java +++ b/src/main/java/com/hotlcc/wechat4j/Wechat.java @@ -1176,7 +1176,7 @@ public class Wechat { */ public JSONObject sendTextToNickName(String nickName, String content) { if (StringUtil.isEmpty(nickName)) { - return sendText(content, null); + return sendText(null, content); } UserInfo userInfo = getContactByNickName(false, nickName); @@ -1189,7 +1189,7 @@ public class Wechat { return null; } - return sendText(content, userName); + return sendText(userName, content); } /** @@ -1201,7 +1201,7 @@ public class Wechat { */ public JSONObject sendTextToRemarkName(String remarkName, String content) { if (StringUtil.isEmpty(remarkName)) { - return sendText(content, null); + return sendText(null, content); } UserInfo userInfo = getContactByRemarkName(false, remarkName); @@ -1214,7 +1214,7 @@ public class Wechat { return null; } - return sendText(content, userName); + return sendText(userName, content); } /** @@ -1230,14 +1230,14 @@ public class Wechat { UserInfo userInfo; if (StringUtil.isNotEmpty(userName)) { - return sendText(content, userName); + return sendText(userName, content); } 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); + return sendText(loginUserName, content); } if (userInfo == null) { @@ -1247,7 +1247,7 @@ public class Wechat { if (StringUtil.isEmpty(userName)) { return null; } - return sendText(content, userName); + return sendText(userName, content); } /** diff --git a/src/test/java/TestClass.java b/src/test/java/TestClass.java index 0a0cf5b..92bb6a8 100644 --- a/src/test/java/TestClass.java +++ b/src/test/java/TestClass.java @@ -30,6 +30,11 @@ public class TestClass { wechat.autoLogin(); } + public void testSendText() { + JSONObject result = wechat.sendText(null, "这是消息内容"); + System.out.println(result); + } + @Test public void testSendImage() { File file = new File("D:\\Downloads\\images\\6600e90b8b0ce2037a5291a7147ffd2b.jpeg"); From f0b16900233d6f40c2c8a32879689d211be983b2 Mon Sep 17 00:00:00 2001 From: Allen Date: Wed, 19 Sep 2018 16:57:58 +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.2.1->0.2.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 e439a01..2cb63ff 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.hotlcc wechat4j - 0.2.1 + 0.2.2 wechat4j Wechat client for Java.