mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-24 16:18:51 +08:00
issue #82 增加邀请成员关注接口
This commit is contained in:
parent
b921490253
commit
b43a62c3a6
@ -315,6 +315,18 @@ public interface WxCpService {
|
|||||||
*/
|
*/
|
||||||
public void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorException;
|
public void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* 邀请成员关注
|
||||||
|
* http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E9.82.80.E8.AF.B7.E6.88.90.E5.91.98.E5.85.B3.E6.B3.A8
|
||||||
|
* </pre>
|
||||||
|
* @param userId 用户的userid
|
||||||
|
* @param inviteTips 推送到微信上的提示语(只有认证号可以使用)。当使用微信推送时,该字段默认为“请关注XXX企业号”,邮件邀请时,该字段无效。
|
||||||
|
* @return 1:微信邀请 2.邮件邀请
|
||||||
|
* @throws WxErrorException
|
||||||
|
*/
|
||||||
|
public int invite(String userId, String inviteTips) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求
|
* 当本Service没有实现某个API的时候,可以用这个,针对所有微信API中的GET请求
|
||||||
* @param url
|
* @param url
|
||||||
|
@ -357,6 +357,18 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int invite(String userId, String inviteTips) throws WxErrorException {
|
||||||
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/invite/send";
|
||||||
|
JsonObject jsonObject = new JsonObject();
|
||||||
|
jsonObject.addProperty("userid", userId);
|
||||||
|
if (StringUtils.isNotEmpty(inviteTips)) {
|
||||||
|
jsonObject.addProperty("invite_tips", inviteTips);
|
||||||
|
}
|
||||||
|
String responseContent = execute(new SimplePostRequestExecutor(), url, jsonObject.toString());
|
||||||
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
||||||
|
return tmpJsonElement.getAsJsonObject().get("type").getAsInt();
|
||||||
|
}
|
||||||
|
|
||||||
public String get(String url, String queryParam) throws WxErrorException {
|
public String get(String url, String queryParam) throws WxErrorException {
|
||||||
return execute(new SimpleGetRequestExecutor(), url, queryParam);
|
return execute(new SimpleGetRequestExecutor(), url, queryParam);
|
||||||
|
Loading…
Reference in New Issue
Block a user