mirror of
https://gitee.com/hotlcc/wechat4j.git
synced 2025-06-06 10:34:07 +08:00
commit
533f936ac0
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.hotlcc</groupId>
|
||||
<artifactId>wechat4j</artifactId>
|
||||
<version>0.2.1</version>
|
||||
<version>0.2.2</version>
|
||||
|
||||
<name>wechat4j</name>
|
||||
<description>Wechat client for Java.</description>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user