Skip to content

Commit 815ea18

Browse files
committed
简化代码
1 parent 742c74d commit 815ea18

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpUserServiceImpl.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import com.google.gson.JsonObject;
66

77
import me.chanjar.weixin.common.exception.WxErrorException;
8-
import me.chanjar.weixin.common.util.http.SimpleGetRequestExecutor;
9-
import me.chanjar.weixin.common.util.http.SimplePostRequestExecutor;
108
import me.chanjar.weixin.mp.api.WxMpService;
119
import me.chanjar.weixin.mp.api.WxMpUserService;
1210
import me.chanjar.weixin.mp.bean.WxMpUserQuery;
@@ -30,27 +28,30 @@ public void userUpdateRemark(String openid, String remark) throws WxErrorExcepti
3028
JsonObject json = new JsonObject();
3129
json.addProperty("openid", openid);
3230
json.addProperty("remark", remark);
33-
this.wxMpService.execute(new SimplePostRequestExecutor(), url, json.toString());
31+
this.wxMpService.post(url, json.toString());
3432
}
3533

3634
@Override
3735
public WxMpUser userInfo(String openid, String lang) throws WxErrorException {
3836
String url = API_URL_PREFIX + "/info";
3937
lang = lang == null ? "zh_CN" : lang;
40-
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, "openid=" + openid + "&lang=" + lang);
38+
String responseContent = this.wxMpService.get(url,
39+
"openid=" + openid + "&lang=" + lang);
4140
return WxMpUser.fromJson(responseContent);
4241
}
4342

4443
@Override
4544
public WxMpUserList userList(String next_openid) throws WxErrorException {
4645
String url = API_URL_PREFIX + "/get";
47-
String responseContent = this.wxMpService.execute(new SimpleGetRequestExecutor(), url, next_openid == null ? null : "next_openid=" + next_openid);
46+
String responseContent = this.wxMpService.get(url,
47+
next_openid == null ? null : "next_openid=" + next_openid);
4848
return WxMpUserList.fromJson(responseContent);
4949
}
5050

5151
@Override
52-
public List<WxMpUser> userInfoList(List<String> openidList) throws WxErrorException {
53-
return userInfoList(new WxMpUserQuery(openidList));
52+
public List<WxMpUser> userInfoList(List<String> openids)
53+
throws WxErrorException {
54+
return this.userInfoList(new WxMpUserQuery(openids));
5455
}
5556

5657
@Override

0 commit comments

Comments
 (0)