Java Code Examples for me.chanjar.weixin.mp.bean.result.WxMpUser#setHeadImgUrl()
The following examples show how to use
me.chanjar.weixin.mp.bean.result.WxMpUser#setHeadImgUrl() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WxMpUserGsonAdapter.java From weixin-java-tools with Apache License 2.0 | 5 votes |
public WxMpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject o = json.getAsJsonObject(); WxMpUser wxMpUser = new WxMpUser(); Integer subscribe = GsonHelper.getInteger(o, "subscribe"); if (subscribe != null) { wxMpUser.setSubscribe(new Integer(0).equals(subscribe) ? false : true); } wxMpUser.setCity(GsonHelper.getString(o, "city")); wxMpUser.setCountry(GsonHelper.getString(o, "country")); wxMpUser.setHeadImgUrl(GsonHelper.getString(o, "headimgurl")); wxMpUser.setLanguage(GsonHelper.getString(o, "language")); wxMpUser.setNickname(GsonHelper.getString(o, "nickname")); wxMpUser.setOpenId(GsonHelper.getString(o, "openid")); wxMpUser.setProvince(GsonHelper.getString(o, "province")); wxMpUser.setSubscribeTime(GsonHelper.getLong(o, "subscribe_time")); wxMpUser.setUnionId(GsonHelper.getString(o, "unionid")); Integer sexId = GsonHelper.getInteger(o, "sex"); wxMpUser.setRemark(GsonHelper.getString(o, "remark")); wxMpUser.setGroupId(GsonHelper.getInteger(o, "groupid")); wxMpUser.setSexId(sexId); if(new Integer(1).equals(sexId)) { wxMpUser.setSex("男"); } else if (new Integer(2).equals(sexId)) { wxMpUser.setSex("女"); } else { wxMpUser.setSex("未知"); } return wxMpUser; }
Example 2
Source File: WxMpUserGsonAdapter.java From weixin-java-tools with Apache License 2.0 | 4 votes |
@Override public WxMpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { JsonObject o = json.getAsJsonObject(); WxMpUser user = new WxMpUser(); Integer subscribe = GsonHelper.getInteger(o, "subscribe"); if (subscribe != null) { user.setSubscribe(!new Integer(0).equals(subscribe)); } user.setCity(GsonHelper.getString(o, "city")); user.setCountry(GsonHelper.getString(o, "country")); user.setHeadImgUrl(GsonHelper.getString(o, "headimgurl")); user.setLanguage(GsonHelper.getString(o, "language")); user.setNickname(GsonHelper.getString(o, "nickname")); user.setOpenId(GsonHelper.getString(o, "openid")); user.setProvince(GsonHelper.getString(o, "province")); user.setSubscribeTime(GsonHelper.getLong(o, "subscribe_time")); user.setUnionId(GsonHelper.getString(o, "unionid")); user.setRemark(GsonHelper.getString(o, "remark")); user.setGroupId(GsonHelper.getInteger(o, "groupid")); user.setTagIds(GsonHelper.getLongArray(o, "tagid_list")); user.setPrivileges(GsonHelper.getStringArray(o, "privilege")); user.setSubscribeScene(GsonHelper.getString(o, "subscribe_scene")); user.setQrScene(GsonHelper.getString(o, "qr_scene")); user.setQrSceneStr(GsonHelper.getString(o, "qr_scene_str")); Integer sex = GsonHelper.getInteger(o, "sex"); if (sex != null) { user.setSex(sex); switch (sex) { case 1: user.setSexDesc("男"); break; case 2: user.setSexDesc("女"); break; default: user.setSexDesc("未知"); } } return user; }