mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	规范统一openid的问题 #177
This commit is contained in:
		| @ -14,8 +14,8 @@ public class WxMpUserList { | |||||||
|  |  | ||||||
|   protected int total = -1; |   protected int total = -1; | ||||||
|   protected int count = -1; |   protected int count = -1; | ||||||
|   protected List<String> openIds = new ArrayList<>(); |   protected List<String> openids = new ArrayList<>(); | ||||||
|   protected String nextOpenId; |   protected String nextOpenid; | ||||||
|   public int getTotal() { |   public int getTotal() { | ||||||
|     return this.total; |     return this.total; | ||||||
|   } |   } | ||||||
| @ -28,19 +28,19 @@ public class WxMpUserList { | |||||||
|   public void setCount(int count) { |   public void setCount(int count) { | ||||||
|     this.count = count; |     this.count = count; | ||||||
|   } |   } | ||||||
|   public List<String> getOpenIds() { |   public List<String> getOpenids() { | ||||||
|     return this.openIds; |     return this.openids; | ||||||
|   } |   } | ||||||
|   public void setOpenIds(List<String> openIds) { |   public void setOpenids(List<String> openids) { | ||||||
|     this.openIds = openIds; |     this.openids = openids; | ||||||
|   } |   } | ||||||
|   public String getNextOpenId() { |   public String getNextOpenid() { | ||||||
|     return this.nextOpenId; |     return this.nextOpenid; | ||||||
|   } |   } | ||||||
|   public void setNextOpenId(String nextOpenId) { |   public void setNextOpenid(String nextOpenid) { | ||||||
|     this.nextOpenId = nextOpenId; |     this.nextOpenid = nextOpenid; | ||||||
|   } |   } | ||||||
|    |  | ||||||
|   public static WxMpUserList fromJson(String json) { |   public static WxMpUserList fromJson(String json) { | ||||||
|     return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUserList.class); |     return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUserList.class); | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -22,11 +22,11 @@ public class WxUserListGsonAdapter implements JsonDeserializer<WxMpUserList> { | |||||||
|     WxMpUserList wxMpUserList = new WxMpUserList(); |     WxMpUserList wxMpUserList = new WxMpUserList(); | ||||||
|     wxMpUserList.setTotal(GsonHelper.getInteger(o, "total")); |     wxMpUserList.setTotal(GsonHelper.getInteger(o, "total")); | ||||||
|     wxMpUserList.setCount(GsonHelper.getInteger(o, "count")); |     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()) { |     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(); |       JsonArray data = o.get("data").getAsJsonObject().get("openid").getAsJsonArray(); | ||||||
|       for (int i = 0; i < data.size(); i++) { |       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; |     return wxMpUserList; | ||||||
|  | |||||||
| @ -70,7 +70,7 @@ public class WxMpUserServiceImplTest { | |||||||
|     Assert.assertNotNull(wxMpUserList); |     Assert.assertNotNull(wxMpUserList); | ||||||
|     Assert.assertFalse(wxMpUserList.getCount() == -1); |     Assert.assertFalse(wxMpUserList.getCount() == -1); | ||||||
|     Assert.assertFalse(wxMpUserList.getTotal() == -1); |     Assert.assertFalse(wxMpUserList.getTotal() == -1); | ||||||
|     Assert.assertFalse(wxMpUserList.getOpenIds().size() == -1); |     Assert.assertFalse(wxMpUserList.getOpenids().size() == -1); | ||||||
|     System.out.println(wxMpUserList); |     System.out.println(wxMpUserList); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang