修改代码格式使用两个空格

This commit is contained in:
aimil
2016-08-31 17:33:09 +08:00
parent 5525c4fa27
commit 4047f6dbd6
4 changed files with 369 additions and 384 deletions

View File

@@ -14,55 +14,55 @@ import me.chanjar.weixin.mp.bean.result.WxMpUserList;
*/
public interface WxMpUserService {
/**
* <pre>
* 设置用户备注名接口
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=设置用户备注名接口
* </pre>
*
* @param openid 用户openid
* @param remark 备注名
*/
void userUpdateRemark(String openid, String remark) throws WxErrorException;
/**
* <pre>
* 设置用户备注名接口
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=设置用户备注名接口
* </pre>
*
* @param openid 用户openid
* @param remark 备注名
*/
void userUpdateRemark(String openid, String remark) throws WxErrorException;
/**
* <pre>
* 获取用户基本信息
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息
* </pre>
*
* @param openid 用户openid
* @param lang 语言zh_CN 简体(默认)zh_TW 繁体en 英语
*/
WxMpUser userInfo(String openid, String lang) throws WxErrorException;
/**
* <pre>
* 获取用户基本信息
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息
* </pre>
*
* @param openid 用户openid
* @param lang 语言zh_CN 简体(默认)zh_TW 繁体en 英语
*/
WxMpUser userInfo(String openid, String lang) throws WxErrorException;
/**
* <pre>
* 获取用户基本信息列表
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息
* </pre>
*
* @param openid 用户openid, lang 使用默认(zh_CN 简体)
*/
List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException;
/**
* <pre>
* 获取用户基本信息列表
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息
* </pre>
*
* @param openid 用户openid, lang 使用默认(zh_CN 简体)
*/
List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException;
/**
* <pre>
* 获取用户基本信息列表
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息
* </pre>
*
* @param userQuery 详细查询参数
*/
List<WxMpUser> userInfoList(WxMpUserQuery userQuery) throws WxErrorException;
/**
* <pre>
* 获取用户基本信息列表
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=批量获取用户基本信息
* </pre>
*
* @param userQuery 详细查询参数
*/
List<WxMpUser> userInfoList(WxMpUserQuery userQuery) throws WxErrorException;
/**
* <pre>
* 获取关注者列表
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表
* </pre>
*
* @param nextOpenid 可选第一个拉取的OPENIDnull为从头开始拉取
*/
WxMpUserList userList(String nextOpenid) throws WxErrorException;
/**
* <pre>
* 获取关注者列表
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表
* </pre>
*
* @param nextOpenid 可选第一个拉取的OPENIDnull为从头开始拉取
*/
WxMpUserList userList(String nextOpenid) throws WxErrorException;
}

View File

@@ -17,47 +17,47 @@ import me.chanjar.weixin.mp.bean.result.WxMpUserList;
* Created by Binary Wang on 2016/7/21.
*/
public class WxMpUserServiceImpl implements WxMpUserService {
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/user";
private WxMpService wxMpService;
private static final String API_URL_PREFIX = "https://api.weixin.qq.com/cgi-bin/user";
private WxMpService wxMpService;
public WxMpUserServiceImpl(WxMpService wxMpService) {
this.wxMpService = wxMpService;
}
public WxMpUserServiceImpl(WxMpService wxMpService) {
this.wxMpService = wxMpService;
}
@Override
public void userUpdateRemark(String openid, String remark) throws WxErrorException {
String url = API_URL_PREFIX + "/info/updateremark";
JsonObject json = new JsonObject();
json.addProperty("openid", openid);
json.addProperty("remark", remark);
this.wxMpService.execute(new SimplePostRequestExecutor(), url, json.toString());
}
@Override
public void userUpdateRemark(String openid, String remark) throws WxErrorException {
String url = API_URL_PREFIX + "/info/updateremark";
JsonObject json = new JsonObject();
json.addProperty("openid", openid);
json.addProperty("remark", remark);
this.wxMpService.execute(new SimplePostRequestExecutor(), url, json.toString());
}
@Override
public WxMpUser userInfo(String openid, String lang) throws WxErrorException {
String url = API_URL_PREFIX + "/info";
lang = lang == null ? "zh_CN" : lang;
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "openid=" + openid + "&lang=" + lang);
return WxMpUser.fromJson(responseContent);
}
@Override
public WxMpUser userInfo(String openid, String lang) throws WxErrorException {
String url = API_URL_PREFIX + "/info";
lang = lang == null ? "zh_CN" : lang;
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "openid=" + openid + "&lang=" + lang);
return WxMpUser.fromJson(responseContent);
}
@Override
public WxMpUserList userList(String next_openid) throws WxErrorException {
String url = API_URL_PREFIX + "/get";
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, next_openid == null ? null : "next_openid=" + next_openid);
return WxMpUserList.fromJson(responseContent);
}
@Override
public WxMpUserList userList(String next_openid) throws WxErrorException {
String url = API_URL_PREFIX + "/get";
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, next_openid == null ? null : "next_openid=" + next_openid);
return WxMpUserList.fromJson(responseContent);
}
@Override
public List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException {
return userInfoList(new WxMpUserQuery(openidList));
}
@Override
public List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException {
return userInfoList(new WxMpUserQuery(openidList));
}
@Override
public List<WxMpUser> userInfoList(WxMpUserQuery userQuery) throws WxErrorException {
String url = API_URL_PREFIX + "/info/batchget";
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, userQuery.toJsonString());
return WxMpUser.fromJsonList(responseContent);
}
@Override
public List<WxMpUser> userInfoList(WxMpUserQuery userQuery) throws WxErrorException {
String url = API_URL_PREFIX + "/info/batchget";
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, userQuery.toJsonString());
return WxMpUser.fromJsonList(responseContent);
}
}