mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-23 22:11:40 +08:00
简化代码
This commit is contained in:
parent
742c74d850
commit
815ea188e7
@ -5,8 +5,6 @@ import java.util.List;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||||
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
|
|
||||||
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
|
|
||||||
import me.chanjar.weixin.mp.api.WxMpService;
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
import me.chanjar.weixin.mp.api.WxMpUserService;
|
import me.chanjar.weixin.mp.api.WxMpUserService;
|
||||||
import me.chanjar.weixin.mp.bean.WxMpUserQuery;
|
import me.chanjar.weixin.mp.bean.WxMpUserQuery;
|
||||||
@ -30,27 +28,30 @@ public class WxMpUserServiceImpl implements WxMpUserService {
|
|||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("openid", openid);
|
json.addProperty("openid", openid);
|
||||||
json.addProperty("remark", remark);
|
json.addProperty("remark", remark);
|
||||||
this.wxMpService.execute(new SimplePostRequestExecutor(), url, json.toString());
|
this.wxMpService.post(url, json.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxMpUser userInfo(String openid, String lang) throws WxErrorException {
|
public WxMpUser userInfo(String openid, String lang) throws WxErrorException {
|
||||||
String url = API_URL_PREFIX + "/info";
|
String url = API_URL_PREFIX + "/info";
|
||||||
lang = lang == null ? "zh_CN" : lang;
|
lang = lang == null ? "zh_CN" : lang;
|
||||||
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "openid=" + openid + "&lang=" + lang);
|
String responseContent = this.wxMpService.get(url,
|
||||||
|
"openid=" + openid + "&lang=" + lang);
|
||||||
return WxMpUser.fromJson(responseContent);
|
return WxMpUser.fromJson(responseContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxMpUserList userList(String next_openid) throws WxErrorException {
|
public WxMpUserList userList(String next_openid) throws WxErrorException {
|
||||||
String url = API_URL_PREFIX + "/get";
|
String url = API_URL_PREFIX + "/get";
|
||||||
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, next_openid == null ? null : "next_openid=" + next_openid);
|
String responseContent = this.wxMpService.get(url,
|
||||||
|
next_openid == null ? null : "next_openid=" + next_openid);
|
||||||
return WxMpUserList.fromJson(responseContent);
|
return WxMpUserList.fromJson(responseContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException {
|
public List<WxMpUser> userInfoList(List<String> openids)
|
||||||
return userInfoList(new WxMpUserQuery(openidList));
|
throws WxErrorException {
|
||||||
|
return this.userInfoList(new WxMpUserQuery(openids));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user