包括如下接口:
- createUserTag - 創(chuàng)建用戶標(biāo)簽
- deleteUserTag - 刪除用戶標(biāo)簽
- queryAllUserTag - 查詢所有用戶標(biāo)簽
- updateUserTagName - 更新用戶標(biāo)簽名字
- batchMovingUserToNewTag - 批量移動(dòng)用戶到某標(biāo)簽
- batchRemoveUserTag - 批量移除用戶到某標(biāo)簽
- updateUserRemark - 更新用戶備注
- getUserInfoByOpenId - 獲取用戶信息基本信息
- batchGetUserInfo - 批量查詢用戶信息
- batchGetUserOpenId - 批量查詢關(guān)注者openid
- oauth2buildAuthorizationUrl - Oauth2.0 認(rèn)證
- oauth2ToGetAccessToken- Oauth2.0 認(rèn)證
- oauth2ToGetUserInfo- Oauth2.0 認(rèn)證
- batchAddUserToBlackList- 批量把用戶添加到黑名單
- batchRemoveUserFromBlackList- 批量把用戶刪除黑名單
- batchGetUsersFromBlackList- 批量獲取黑名單用戶列表
try {
WxUserTagResult result = iService.createUserTag("標(biāo)簽名");
System.out.println(result.getTag().getId());
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
WxError result = iService.deleteUserTag(創(chuàng)建tag時(shí)返回的ID);
System.out.println(result);
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
WxUserTagResult result = iService.queryAllUserTag();
System.out.println(result);
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
//標(biāo)簽ID,新標(biāo)簽名
iService.updateUserTagName(1, "new tag name");
} catch (WxErrorException e) {
e.printStackTrace();
}
List<String> openidList = new ArrayList<>();
openidList.add("openid1");
openidList.add("openid2");
try {
//用戶Openid列表, tagID
iService.batchMovingUserToNewTag(openidList, 2);
} catch (WxErrorException e) {
e.printStackTrace();
}
List<String> openidList = new ArrayList<>();
openidList.add("openid1");
openidList.add("openid2");
try {
//用戶Openid列表, tagID
iService.batchRemoveUserTag(openidList, 2);
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
iService.updateUserRemark("openid", "備注名");
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
WxUser user = iService.getUserInfoByOpenId(new WxUserGet("openid", WxConsts.LANG_CHINA));
System.out.println(user.toString());
} catch (WxErrorException e) {
e.printStackTrace();
}
List<WxUserGet> list = new ArrayList<>();
WxUserGet userGet1 = new WxUserGet("openid", WxConsts.LANG_CHINA);
WxUserGet userGet2 = new WxUserGet("openid", WxConsts.LANG_CHINA);
list.add(userGet1);
list.add(userGet2);
try {
WxUserList userList = iService.batchGetUserInfo(list);
System.out.println(userList.toString());
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
//第一個(gè)openid之后拉取
WxUserListResult result = iService.batchGetUserOpenId("next openid");
System.out.println(result.getNext_openid());
System.out.println(result.getData());
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
String oauthUrl = iService.oauth2buildAuthorizationUrl("回調(diào)URL",WxConsts.OAUTH2_SCOPE_USER_INFO, "自定義攜帶參數(shù)");
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
WxOAuth2AccessTokenResult result = iService.oauth2ToGetAccessToken("code");
System.out.println(result.getAccess_token());
System.out.println(result.getOpenid());
} catch (WxErrorException e) {
e.printStackTrace();
}
try {
WxUser user = iService.oauth2ToGetUserInfo("token", new WxUserGet("openid", WxConsts.LANG_CHINA));
} catch (WxErrorException e) {
e.printStackTrace();
}
WxError result = iService.batchAddUserToBlackList(Arrays.asList("openid"));
System.out.println(result);
WxError result = iService.batchRemoveUserFromBlackList(Arrays.asList("openid"));
System.out.println(result);
WxUserListResult result = iService.batchGetUsersFromBlackList("next_openid");
System.out.println(result);
更多建議: