Skip to content

Commit

Permalink
规范统一openid的问题 binarywang#177
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Apr 10, 2017
1 parent 66f04c4 commit bc0fbf7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public class WxMpUserList {

protected int total = -1;
protected int count = -1;
protected List<String> openIds = new ArrayList<>();
protected String nextOpenId;
protected List<String> openids = new ArrayList<>();
protected String nextOpenid;
public int getTotal() {
return this.total;
}
Expand All @@ -28,19 +28,19 @@ public int getCount() {
public void setCount(int count) {
this.count = count;
}
public List<String> getOpenIds() {
return this.openIds;
public List<String> getOpenids() {
return this.openids;
}
public void setOpenIds(List<String> openIds) {
this.openIds = openIds;
public void setOpenids(List<String> openids) {
this.openids = openids;
}
public String getNextOpenId() {
return this.nextOpenId;
public String getNextOpenid() {
return this.nextOpenid;
}
public void setNextOpenId(String nextOpenId) {
this.nextOpenId = nextOpenId;
public void setNextOpenid(String nextOpenid) {
this.nextOpenid = nextOpenid;
}

public static WxMpUserList fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUserList.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public WxMpUserList deserialize(JsonElement json, Type typeOfT, JsonDeserializat
WxMpUserList wxMpUserList = new WxMpUserList();
wxMpUserList.setTotal(GsonHelper.getInteger(o, "total"));
wxMpUserList.setCount(GsonHelper.getInteger(o, "count"));
wxMpUserList.setNextOpenId(GsonHelper.getString(o, "next_openid"));
wxMpUserList.setNextOpenid(GsonHelper.getString(o, "next_openid"));
if (o.get("data") != null && !o.get("data").isJsonNull() && !o.get("data").getAsJsonObject().get("openid").isJsonNull()) {
JsonArray data = o.get("data").getAsJsonObject().get("openid").getAsJsonArray();
for (int i = 0; i < data.size(); i++) {
wxMpUserList.getOpenIds().add(GsonHelper.getAsString(data.get(i)));
wxMpUserList.getOpenids().add(GsonHelper.getAsString(data.get(i)));
}
}
return wxMpUserList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void testUserList() throws WxErrorException {
Assert.assertNotNull(wxMpUserList);
Assert.assertFalse(wxMpUserList.getCount() == -1);
Assert.assertFalse(wxMpUserList.getTotal() == -1);
Assert.assertFalse(wxMpUserList.getOpenIds().size() == -1);
Assert.assertFalse(wxMpUserList.getOpenids().size() == -1);
System.out.println(wxMpUserList);
}

Expand Down

0 comments on commit bc0fbf7

Please sign in to comment.