mirror of
https://gitee.com/hotlcc/wechat4j.git
synced 2025-06-28 21:22:46 +08:00
提交代码:添加发送文本消息(根据多种名称)的方法
This commit is contained in:
parent
b1572e2bc7
commit
76a2fa0dc1
@ -1178,6 +1178,39 @@ public class Wechat {
|
|||||||
return sendText(content, userName);
|
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 待完成
|
//TODO 待完成
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public JSONObject sendImage(File image, String userName) {
|
public JSONObject sendImage(File image, String userName) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user