1.rename openId to openid 2.rename blackList to blacklist 3.refine blacklist test

This commit is contained in:
miller
2016-09-20 15:22:59 +08:00
parent b941a57ccd
commit 63c41d44ab
16 changed files with 143 additions and 139 deletions

View File

@@ -370,5 +370,5 @@ public interface WxMpService {
*
* @return WxMpUserBlackListService
*/
WxMpUserBlackListService getBlackListService();
WxMpUserBlacklistService getBlackListService();
}

View File

@@ -1,21 +1,21 @@
package me.chanjar.weixin.mp.api;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.bean.result.WxMpUserBlackListGetResult;
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
import java.util.List;
/**
* @author miller
*/
public interface WxMpUserBlackListService {
public interface WxMpUserBlacklistService {
/**
* <pre>
* 获取公众号的黑名单列表
* 详情请见http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1471422259_pJMWA&token=&lang=zh_CN
* </pre>
*/
WxMpUserBlackListGetResult blackList(String nextOpenid) throws WxErrorException;
WxMpUserBlacklistGetResult getBlacklist(String nextOpenid) throws WxErrorException;
/**
* <pre>
@@ -23,7 +23,7 @@ public interface WxMpUserBlackListService {
* 详情请见http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1471422259_pJMWA&token=&lang=zh_CN
* </pre>
*/
void pushToBlackList(List<String> openIdList) throws WxErrorException;
void pushToBlacklist(List<String> openidList) throws WxErrorException;
/**
* <pre>
@@ -31,5 +31,5 @@ public interface WxMpUserBlackListService {
* 详情请见http://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1471422259_pJMWA&token=&lang=zh_CN
* </pre>
*/
void pullFromBlackList(List<String> openIdList) throws WxErrorException;
void pullFromBlacklist(List<String> openidList) throws WxErrorException;
}

View File

@@ -28,7 +28,7 @@ import me.chanjar.weixin.mp.api.WxMpMenuService;
import me.chanjar.weixin.mp.api.WxMpPayService;
import me.chanjar.weixin.mp.api.WxMpQrcodeService;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxMpUserBlackListService;
import me.chanjar.weixin.mp.api.WxMpUserBlacklistService;
import me.chanjar.weixin.mp.api.WxMpUserService;
import me.chanjar.weixin.mp.api.WxMpUserTagService;
import me.chanjar.weixin.mp.bean.WxMpIndustry;
@@ -95,7 +95,7 @@ public class WxMpServiceImpl implements WxMpService {
private WxMpDataCubeService dataCubeService = new WxMpDataCubeServiceImpl(this);
private WxMpUserBlackListService blackListService = new WxMpUserBlackListServiceImpl(this);
private WxMpUserBlacklistService blackListService = new WxMpUserBlacklistServiceImpl(this);
private CloseableHttpClient httpClient;
@@ -582,7 +582,7 @@ public class WxMpServiceImpl implements WxMpService {
}
@Override
public WxMpUserBlackListService getBlackListService() {
public WxMpUserBlacklistService getBlackListService() {
return this.blackListService;
}

View File

@@ -5,8 +5,8 @@ import com.google.gson.JsonObject;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.api.WxMpUserBlackListService;
import me.chanjar.weixin.mp.bean.result.WxMpUserBlackListGetResult;
import me.chanjar.weixin.mp.api.WxMpUserBlacklistService;
import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
import java.util.HashMap;
import java.util.List;
@@ -15,36 +15,36 @@ import java.util.Map;
/**
* @author miller
*/
public class WxMpUserBlackListServiceImpl implements WxMpUserBlackListService {
private static final String API_BLACK_LIST_PREFIX = "https://api.weixin.qq.com/cgi-bin/tags/members";
public class WxMpUserBlacklistServiceImpl implements WxMpUserBlacklistService {
private static final String API_BLACKLIST_PREFIX = "https://api.weixin.qq.com/cgi-bin/tags/members";
private WxMpService wxMpService;
public WxMpUserBlackListServiceImpl(WxMpService wxMpService) {
public WxMpUserBlacklistServiceImpl(WxMpService wxMpService) {
this.wxMpService = wxMpService;
}
@Override
public WxMpUserBlackListGetResult blackList(String nextOpenid) throws WxErrorException {
public WxMpUserBlacklistGetResult getBlacklist(String nextOpenid) throws WxErrorException {
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("begin_openid", nextOpenid);
String url = API_BLACK_LIST_PREFIX + "/getblacklist";
String url = API_BLACKLIST_PREFIX + "/getblacklist";
String responseContent = this.wxMpService.execute(new SimplePostRequestExecutor(), url, jsonObject.toString());
return WxMpUserBlackListGetResult.fromJson(responseContent);
return WxMpUserBlacklistGetResult.fromJson(responseContent);
}
@Override
public void pushToBlackList(List<String> openIdList) throws WxErrorException {
public void pushToBlacklist(List<String> openidList) throws WxErrorException {
Map<String, Object> map = new HashMap<>();
map.put("openid_list", openIdList);
String url = API_BLACK_LIST_PREFIX + "/batchblacklist";
map.put("openid_list", openidList);
String url = API_BLACKLIST_PREFIX + "/batchblacklist";
this.wxMpService.execute(new SimplePostRequestExecutor(), url, new Gson().toJson(map));
}
@Override
public void pullFromBlackList(List<String> openIdList) throws WxErrorException {
public void pullFromBlacklist(List<String> openidList) throws WxErrorException {
Map<String, Object> map = new HashMap<>();
map.put("openid_list", openIdList);
String url = API_BLACK_LIST_PREFIX + "/batchunblacklist";
map.put("openid_list", openidList);
String url = API_BLACKLIST_PREFIX + "/batchunblacklist";
this.wxMpService.execute(new SimplePostRequestExecutor(), url, new Gson().toJson(map));
}
}