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