mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-09-20 18:48:13 +08:00
修改一下方法签名,代码洁癖
This commit is contained in:
@@ -33,7 +33,7 @@ public interface WxCpService {
|
|||||||
* @param data 微信传输过来的数据,有可能是echoStr,有可能是xml消息
|
* @param data 微信传输过来的数据,有可能是echoStr,有可能是xml消息
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean checkSignature(String msgSignature, String timestamp, String nonce, String data);
|
boolean checkSignature(String msgSignature, String timestamp, String nonce, String data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -43,7 +43,7 @@ public interface WxCpService {
|
|||||||
*
|
*
|
||||||
* @param userId
|
* @param userId
|
||||||
*/
|
*/
|
||||||
public void userAuthenticated(String userId) throws WxErrorException;
|
void userAuthenticated(String userId) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取access_token, 不强制刷新access_token
|
* 获取access_token, 不强制刷新access_token
|
||||||
@@ -51,7 +51,7 @@ public interface WxCpService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public String getAccessToken() throws WxErrorException;
|
String getAccessToken() throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -65,7 +65,7 @@ public interface WxCpService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws me.chanjar.weixin.common.exception.WxErrorException
|
* @throws me.chanjar.weixin.common.exception.WxErrorException
|
||||||
*/
|
*/
|
||||||
public String getAccessToken(boolean forceRefresh) throws WxErrorException;
|
String getAccessToken(boolean forceRefresh) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -83,7 +83,7 @@ public interface WxCpService {
|
|||||||
* @param inputStream 输入流
|
* @param inputStream 输入流
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream)
|
WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream)
|
||||||
throws WxErrorException, IOException;
|
throws WxErrorException, IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,7 +92,7 @@ public interface WxCpService {
|
|||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @see #mediaUpload(String, String, InputStream)
|
* @see #mediaUpload(String, String, InputStream)
|
||||||
*/
|
*/
|
||||||
public WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException;
|
WxMediaUploadResult mediaUpload(String mediaType, File file) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -105,7 +105,7 @@ public interface WxCpService {
|
|||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
* @params media_id
|
* @params media_id
|
||||||
*/
|
*/
|
||||||
public File mediaDownload(String media_id) throws WxErrorException;
|
File mediaDownload(String media_id) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -116,7 +116,7 @@ public interface WxCpService {
|
|||||||
* @param message
|
* @param message
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void messageSend(WxCpMessage message) throws WxErrorException;
|
void messageSend(WxCpMessage message) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -127,7 +127,7 @@ public interface WxCpService {
|
|||||||
* @param menu
|
* @param menu
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void menuCreate(WxMenu menu) throws WxErrorException;
|
void menuCreate(WxMenu menu) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -137,7 +137,7 @@ public interface WxCpService {
|
|||||||
*
|
*
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void menuDelete() throws WxErrorException;
|
void menuDelete() throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -148,7 +148,7 @@ public interface WxCpService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public WxMenu menuGet() throws WxErrorException;
|
WxMenu menuGet() throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -161,7 +161,7 @@ public interface WxCpService {
|
|||||||
* @return 部门id
|
* @return 部门id
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public Integer departCreate(WxCpDepart depart) throws WxErrorException;
|
Integer departCreate(WxCpDepart depart) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -172,7 +172,7 @@ public interface WxCpService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public List<WxCpDepart> departGet() throws WxErrorException;
|
List<WxCpDepart> departGet() throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -184,7 +184,7 @@ public interface WxCpService {
|
|||||||
* @param group 要更新的group,group的id,name必须设置
|
* @param group 要更新的group,group的id,name必须设置
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void departUpdate(WxCpDepart group) throws WxErrorException;
|
void departUpdate(WxCpDepart group) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -194,7 +194,7 @@ public interface WxCpService {
|
|||||||
* @param departId
|
* @param departId
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void departDelete(Integer departId) throws WxErrorException;
|
void departDelete(Integer departId) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E6.88.90.E5.91.98
|
* http://qydev.weixin.qq.com/wiki/index.php?title=管理成员#.E8.8E.B7.E5.8F.96.E9.83.A8.E9.97.A8.E6.88.90.E5.91.98
|
||||||
@@ -205,7 +205,7 @@ public interface WxCpService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public List<WxCpUser> departGetUsers(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException;
|
List<WxCpUser> departGetUsers(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建用户
|
* 新建用户
|
||||||
@@ -213,7 +213,7 @@ public interface WxCpService {
|
|||||||
* @param user
|
* @param user
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void userCreate(WxCpUser user) throws WxErrorException;
|
void userCreate(WxCpUser user) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新用户
|
* 更新用户
|
||||||
@@ -221,7 +221,7 @@ public interface WxCpService {
|
|||||||
* @param user
|
* @param user
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void userUpdate(WxCpUser user) throws WxErrorException;
|
void userUpdate(WxCpUser user) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
@@ -229,7 +229,7 @@ public interface WxCpService {
|
|||||||
* @param userid
|
* @param userid
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public void userDelete(String userid) throws WxErrorException;
|
void userDelete(String userid) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户
|
* 获取用户
|
||||||
@@ -238,7 +238,7 @@ public interface WxCpService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public WxCpUser userGet(String userid) throws WxErrorException;
|
WxCpUser userGet(String userid) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建标签
|
* 创建标签
|
||||||
@@ -246,7 +246,7 @@ public interface WxCpService {
|
|||||||
* @param tagName
|
* @param tagName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String tagCreate(String tagName) throws WxErrorException;
|
String tagCreate(String tagName) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新标签
|
* 更新标签
|
||||||
@@ -254,21 +254,21 @@ public interface WxCpService {
|
|||||||
* @param tagId
|
* @param tagId
|
||||||
* @param tagName
|
* @param tagName
|
||||||
*/
|
*/
|
||||||
public void tagUpdate(String tagId, String tagName) throws WxErrorException;
|
void tagUpdate(String tagId, String tagName) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标签
|
* 删除标签
|
||||||
*
|
*
|
||||||
* @param tagId
|
* @param tagId
|
||||||
*/
|
*/
|
||||||
public void tagDelete(String tagId) throws WxErrorException;
|
void tagDelete(String tagId) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得标签列表
|
* 获得标签列表
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<WxCpTag> tagGet() throws WxErrorException;
|
List<WxCpTag> tagGet() throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取标签成员
|
* 获取标签成员
|
||||||
@@ -276,7 +276,7 @@ public interface WxCpService {
|
|||||||
* @param tagId
|
* @param tagId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException;
|
List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 增加标签成员
|
* 增加标签成员
|
||||||
@@ -284,7 +284,7 @@ public interface WxCpService {
|
|||||||
* @param tagId
|
* @param tagId
|
||||||
* @param userIds
|
* @param userIds
|
||||||
*/
|
*/
|
||||||
public void tagAddUsers(String tagId, List<String> userIds) throws WxErrorException;
|
void tagAddUsers(String tagId, List<String> userIds) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -294,7 +294,7 @@ public interface WxCpService {
|
|||||||
* @param state
|
* @param state
|
||||||
* @return code
|
* @return code
|
||||||
*/
|
*/
|
||||||
public String oauth2buildAuthorizationUrl(String state);
|
String oauth2buildAuthorizationUrl(String state);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -305,7 +305,7 @@ public interface WxCpService {
|
|||||||
* @param code
|
* @param code
|
||||||
* @return [userid, deviceid]
|
* @return [userid, deviceid]
|
||||||
*/
|
*/
|
||||||
public String[] oauth2getUserInfo(String code) throws WxErrorException;
|
String[] oauth2getUserInfo(String code) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除标签成员
|
* 移除标签成员
|
||||||
@@ -313,7 +313,7 @@ public interface WxCpService {
|
|||||||
* @param tagId
|
* @param tagId
|
||||||
* @param userIds
|
* @param userIds
|
||||||
*/
|
*/
|
||||||
public void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorException;
|
void tagRemoveUsers(String tagId, List<String> userIds) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -325,7 +325,7 @@ public interface WxCpService {
|
|||||||
* @return 1:微信邀请 2.邮件邀请
|
* @return 1:微信邀请 2.邮件邀请
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public int invite(String userId, String inviteTips) throws WxErrorException;
|
int invite(String userId, String inviteTips) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
@@ -369,14 +369,14 @@ public interface WxCpService {
|
|||||||
* @return
|
* @return
|
||||||
* @throws WxErrorException
|
* @throws WxErrorException
|
||||||
*/
|
*/
|
||||||
public <T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException;
|
<T, E> T execute(RequestExecutor<T, E> executor, String uri, E data) throws WxErrorException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注入 {@link WxCpConfigStorage} 的实现
|
* 注入 {@link WxCpConfigStorage} 的实现
|
||||||
*
|
*
|
||||||
* @param wxConfigProvider
|
* @param wxConfigProvider
|
||||||
*/
|
*/
|
||||||
public void setWxCpConfigStorage(WxCpConfigStorage wxConfigProvider);
|
void setWxCpConfigStorage(WxCpConfigStorage wxConfigProvider);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@@ -78,7 +78,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
|
|
||||||
public void userAuthenticated(String userId) throws WxErrorException {
|
public void userAuthenticated(String userId) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/authsucc?userid=" + userId;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/authsucc?userid=" + userId;
|
||||||
execute(new SimpleGetRequestExecutor(), url, null);
|
get(url, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAccessToken() throws WxErrorException {
|
public String getAccessToken() throws WxErrorException {
|
||||||
@@ -123,23 +123,23 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
|
|
||||||
public void messageSend(WxCpMessage message) throws WxErrorException {
|
public void messageSend(WxCpMessage message) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/message/send";
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/message/send";
|
||||||
execute(new SimplePostRequestExecutor(), url, message.toJson());
|
post(url, message.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void menuCreate(WxMenu menu) throws WxErrorException {
|
public void menuCreate(WxMenu menu) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?agentid=" + wxCpConfigStorage.getAgentId();
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/create?agentid=" + wxCpConfigStorage.getAgentId();
|
||||||
execute(new SimplePostRequestExecutor(), url, menu.toJson());
|
post(url, menu.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void menuDelete() throws WxErrorException {
|
public void menuDelete() throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?agentid=" + wxCpConfigStorage.getAgentId();
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/delete?agentid=" + wxCpConfigStorage.getAgentId();
|
||||||
execute(new SimpleGetRequestExecutor(), url, null);
|
get(url, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WxMenu menuGet() throws WxErrorException {
|
public WxMenu menuGet() throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?agentid=" + wxCpConfigStorage.getAgentId();
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/menu/get?agentid=" + wxCpConfigStorage.getAgentId();
|
||||||
try {
|
try {
|
||||||
String resultContent = execute(new SimpleGetRequestExecutor(), url, null);
|
String resultContent = get(url, null);
|
||||||
return WxMenu.fromJson(resultContent);
|
return WxMenu.fromJson(resultContent);
|
||||||
} catch (WxErrorException e) {
|
} catch (WxErrorException e) {
|
||||||
// 46003 不存在的菜单数据
|
// 46003 不存在的菜单数据
|
||||||
@@ -178,17 +178,17 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
|
|
||||||
public void departUpdate(WxCpDepart group) throws WxErrorException {
|
public void departUpdate(WxCpDepart group) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/department/update";
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/department/update";
|
||||||
execute(new SimplePostRequestExecutor(), url, group.toJson());
|
post(url, group.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void departDelete(Integer departId) throws WxErrorException {
|
public void departDelete(Integer departId) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/department/delete?id=" + departId;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/department/delete?id=" + departId;
|
||||||
execute(new SimpleGetRequestExecutor(), url, null);
|
get(url, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WxCpDepart> departGet() throws WxErrorException {
|
public List<WxCpDepart> departGet() throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list";
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/department/list";
|
||||||
String responseContent = execute(new SimpleGetRequestExecutor(), url, null);
|
String responseContent = get(url, null);
|
||||||
/*
|
/*
|
||||||
* 操蛋的微信API,创建时返回的是 { group : { id : ..., name : ...} }
|
* 操蛋的微信API,创建时返回的是 { group : { id : ..., name : ...} }
|
||||||
* 查询时返回的是 { groups : [ { id : ..., name : ..., count : ... }, ... ] }
|
* 查询时返回的是 { groups : [ { id : ..., name : ..., count : ... }, ... ] }
|
||||||
@@ -204,25 +204,25 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
@Override
|
@Override
|
||||||
public void userCreate(WxCpUser user) throws WxErrorException {
|
public void userCreate(WxCpUser user) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/create";
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/create";
|
||||||
execute(new SimplePostRequestExecutor(), url, user.toJson());
|
post(url, user.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void userUpdate(WxCpUser user) throws WxErrorException {
|
public void userUpdate(WxCpUser user) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/update";
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/update";
|
||||||
execute(new SimplePostRequestExecutor(), url, user.toJson());
|
post(url, user.toJson());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void userDelete(String userid) throws WxErrorException {
|
public void userDelete(String userid) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/delete?userid=" + userid;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/delete?userid=" + userid;
|
||||||
execute(new SimpleGetRequestExecutor(), url, null);
|
get(url, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxCpUser userGet(String userid) throws WxErrorException {
|
public WxCpUser userGet(String userid) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/get?userid=" + userid;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/user/get?userid=" + userid;
|
||||||
String responseContent = execute(new SimpleGetRequestExecutor(), url, null);
|
String responseContent = get(url, null);
|
||||||
return WxCpUser.fromJson(responseContent);
|
return WxCpUser.fromJson(responseContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -239,7 +239,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
params += "&status=0";
|
params += "&status=0";
|
||||||
}
|
}
|
||||||
|
|
||||||
String responseContent = execute(new SimpleGetRequestExecutor(), url, params);
|
String responseContent = get(url, params);
|
||||||
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
||||||
return WxCpGsonBuilder.INSTANCE.create()
|
return WxCpGsonBuilder.INSTANCE.create()
|
||||||
.fromJson(
|
.fromJson(
|
||||||
@@ -253,7 +253,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/create";
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/create";
|
||||||
JsonObject o = new JsonObject();
|
JsonObject o = new JsonObject();
|
||||||
o.addProperty("tagname", tagName);
|
o.addProperty("tagname", tagName);
|
||||||
String responseContent = execute(new SimplePostRequestExecutor(), url, o.toString());
|
String responseContent = post(url, o.toString());
|
||||||
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
||||||
return tmpJsonElement.getAsJsonObject().get("tagid").getAsString();
|
return tmpJsonElement.getAsJsonObject().get("tagid").getAsString();
|
||||||
}
|
}
|
||||||
@@ -264,19 +264,19 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
JsonObject o = new JsonObject();
|
JsonObject o = new JsonObject();
|
||||||
o.addProperty("tagid", tagId);
|
o.addProperty("tagid", tagId);
|
||||||
o.addProperty("tagname", tagName);
|
o.addProperty("tagname", tagName);
|
||||||
execute(new SimplePostRequestExecutor(), url, o.toString());
|
post(url, o.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tagDelete(String tagId) throws WxErrorException {
|
public void tagDelete(String tagId) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/delete?tagid=" + tagId;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/delete?tagid=" + tagId;
|
||||||
execute(new SimpleGetRequestExecutor(), url, null);
|
get(url, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WxCpTag> tagGet() throws WxErrorException {
|
public List<WxCpTag> tagGet() throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/list";
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/list";
|
||||||
String responseContent = execute(new SimpleGetRequestExecutor(), url, null);
|
String responseContent = get(url, null);
|
||||||
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
||||||
return WxCpGsonBuilder.INSTANCE.create()
|
return WxCpGsonBuilder.INSTANCE.create()
|
||||||
.fromJson(
|
.fromJson(
|
||||||
@@ -288,7 +288,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
@Override
|
@Override
|
||||||
public List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException {
|
public List<WxCpUser> tagGetUsers(String tagId) throws WxErrorException {
|
||||||
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/get?tagid=" + tagId;
|
String url = "https://qyapi.weixin.qq.com/cgi-bin/tag/get?tagid=" + tagId;
|
||||||
String responseContent = execute(new SimpleGetRequestExecutor(), url, null);
|
String responseContent = get(url, null);
|
||||||
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
||||||
return WxCpGsonBuilder.INSTANCE.create()
|
return WxCpGsonBuilder.INSTANCE.create()
|
||||||
.fromJson(
|
.fromJson(
|
||||||
@@ -307,7 +307,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
jsonArray.add(new JsonPrimitive(userId));
|
jsonArray.add(new JsonPrimitive(userId));
|
||||||
}
|
}
|
||||||
jsonObject.add("userlist", jsonArray);
|
jsonObject.add("userlist", jsonArray);
|
||||||
execute(new SimplePostRequestExecutor(), url, jsonObject.toString());
|
post(url, jsonObject.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -320,7 +320,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
jsonArray.add(new JsonPrimitive(userId));
|
jsonArray.add(new JsonPrimitive(userId));
|
||||||
}
|
}
|
||||||
jsonObject.add("userlist", jsonArray);
|
jsonObject.add("userlist", jsonArray);
|
||||||
execute(new SimplePostRequestExecutor(), url, jsonObject.toString());
|
post(url, jsonObject.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -365,7 +365,7 @@ public class WxCpServiceImpl implements WxCpService {
|
|||||||
if (StringUtils.isNotEmpty(inviteTips)) {
|
if (StringUtils.isNotEmpty(inviteTips)) {
|
||||||
jsonObject.addProperty("invite_tips", inviteTips);
|
jsonObject.addProperty("invite_tips", inviteTips);
|
||||||
}
|
}
|
||||||
String responseContent = execute(new SimplePostRequestExecutor(), url, jsonObject.toString());
|
String responseContent = post(url, jsonObject.toString());
|
||||||
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
JsonElement tmpJsonElement = Streams.parse(new JsonReader(new StringReader(responseContent)));
|
||||||
return tmpJsonElement.getAsJsonObject().get("type").getAsInt();
|
return tmpJsonElement.getAsJsonObject().get("type").getAsInt();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user