2
0
mirror of https://gitee.com/hotlcc/wechat4j.git synced 2025-06-08 03:24:09 +08:00

提交代码:修复参数位置错误的验证bug

This commit is contained in:
Allen 2018-09-19 16:57:07 +08:00
parent 0d8b3c78e7
commit 743d40c847
2 changed files with 12 additions and 7 deletions

View File

@ -1176,7 +1176,7 @@ public class Wechat {
*/ */
public JSONObject sendTextToNickName(String nickName, String content) { public JSONObject sendTextToNickName(String nickName, String content) {
if (StringUtil.isEmpty(nickName)) { if (StringUtil.isEmpty(nickName)) {
return sendText(content, null); return sendText(null, content);
} }
UserInfo userInfo = getContactByNickName(false, nickName); UserInfo userInfo = getContactByNickName(false, nickName);
@ -1189,7 +1189,7 @@ public class Wechat {
return null; return null;
} }
return sendText(content, userName); return sendText(userName, content);
} }
/** /**
@ -1201,7 +1201,7 @@ public class Wechat {
*/ */
public JSONObject sendTextToRemarkName(String remarkName, String content) { public JSONObject sendTextToRemarkName(String remarkName, String content) {
if (StringUtil.isEmpty(remarkName)) { if (StringUtil.isEmpty(remarkName)) {
return sendText(content, null); return sendText(null, content);
} }
UserInfo userInfo = getContactByRemarkName(false, remarkName); UserInfo userInfo = getContactByRemarkName(false, remarkName);
@ -1214,7 +1214,7 @@ public class Wechat {
return null; return null;
} }
return sendText(content, userName); return sendText(userName, content);
} }
/** /**
@ -1230,14 +1230,14 @@ public class Wechat {
UserInfo userInfo; UserInfo userInfo;
if (StringUtil.isNotEmpty(userName)) { if (StringUtil.isNotEmpty(userName)) {
return sendText(content, userName); return sendText(userName, content);
} else if (StringUtil.isNotEmpty(nickName)) { } else if (StringUtil.isNotEmpty(nickName)) {
userInfo = getContactByNickName(false, nickName); userInfo = getContactByNickName(false, nickName);
} else if (StringUtil.isNotEmpty(remarkName)) { } else if (StringUtil.isNotEmpty(remarkName)) {
userInfo = getContactByRemarkName(false, remarkName); userInfo = getContactByRemarkName(false, remarkName);
} else { } else {
String loginUserName = getLoginUserName(false); String loginUserName = getLoginUserName(false);
return sendText(content, loginUserName); return sendText(loginUserName, content);
} }
if (userInfo == null) { if (userInfo == null) {
@ -1247,7 +1247,7 @@ public class Wechat {
if (StringUtil.isEmpty(userName)) { if (StringUtil.isEmpty(userName)) {
return null; return null;
} }
return sendText(content, userName); return sendText(userName, content);
} }
/** /**

View File

@ -30,6 +30,11 @@ public class TestClass {
wechat.autoLogin(); wechat.autoLogin();
} }
public void testSendText() {
JSONObject result = wechat.sendText(null, "这是消息内容");
System.out.println(result);
}
@Test @Test
public void testSendImage() { public void testSendImage() {
File file = new File("D:\\Downloads\\images\\6600e90b8b0ce2037a5291a7147ffd2b.jpeg"); File file = new File("D:\\Downloads\\images\\6600e90b8b0ce2037a5291a7147ffd2b.jpeg");