Ejemplo n.º 1
0
        /** {@inheritDoc} */
        public override void onHttpStatusOK(QQHttpResponse response)
        {
            /*
             * {"retcode":0,"result":
             * {"face":0,"birthday":{"month":0,"year":0,"day":0},
             * "phone":"","occupation":"","allow":1,"college":"","uin":2842465527,"blood":0,
             * "constel":0,"homepage":"","stat":10,"country":"","city":"","personal":"","nick":"平凡",
             * "shengxiao":0,"email":"","token":"d04e802bda6ff115e31c3792199f15aa74f92eb435e75d93",
             * "client_type":1,"province":"","gender":"male","mobile":"-"}}
             */
            try{
                JSONObject json = new JSONObject(response.getResponseString());
                if (json.getInt("retcode") == 0)
                {
                    JSONObject obj = json.getJSONObject("result");
                    //try {
                    //    user.setBirthday(DateUtils.parse(obj.getJSONObject("birthday")));
                    //} catch (ParseException e) {
                    //    user.setBirthday(null);
                    //}
                    user.setOccupation(obj.getString("occupation"));
                    user.setPhone(obj.getString("phone"));
                    //user.setAllow(QQAllow.values()[obj.getInt("allow")]);
                    user.setCollege(obj.getString("college"));
                    if (obj.has("reg_time"))
                    {
                        user.setRegTime(obj.getInt("reg_time"));
                    }
                    user.setUin(obj.getLong("uin"));
                    user.setConstel(obj.getInt("constel"));
                    user.setBlood(obj.getInt("blood"));
                    user.setHomepage(obj.getString("homepage"));
                    user.setStat(obj.getInt("stat"));
                    if (obj.has("vip_info"))
                    {
                        user.setVipLevel(obj.getInt("vip_info")); // VIP等级 0为非VIP
                    }
                    user.setCountry(obj.getString("country"));
                    user.setCity(obj.getString("city"));
                    user.setPersonal(obj.getString("personal"));
                    user.setNickname(obj.getString("nick"));
                    user.setChineseZodiac(obj.getInt("shengxiao"));
                    user.setEmail("email");
                    user.setProvince(obj.getString("province"));
                    user.setGender(obj.getString("gender"));
                    user.setMobile(obj.getString("mobile"));
//             if (obj.has("client_type")) {
//                 user.setClientType(QQClientType.valueOfRaw(obj.getInt("client_type")));
//             }
                }
            } catch (Exception e) {
            }

            notifyActionEvent(QQActionEvent.Type.EVT_OK, user);
        }
Ejemplo n.º 2
0
        /** {@inheritDoc} */
        public override void onHttpStatusOK(QQHttpResponse response)
        {
            JSONObject json = new JSONObject(response.getResponseString());

            if (json.getInt("retcode") == 0)
            {
                JSONObject obj = json.getJSONObject("result");
                //buddy.setBirthday(DateTime.FromBinary(obj.getJSONObject("birthday")));
                buddy.setOccupation(obj.getString("occupation"));
                buddy.setPhone(obj.getString("phone"));
                //buddy.setAllow(QQAllow.values()[obj.getInt("allow")]);
                buddy.setCollege(obj.getString("college"));
                if (!obj.isNull("reg_time"))
                {
                    buddy.setRegTime(obj.getInt("reg_time"));
                }
                buddy.setUin(obj.getLong("uin"));
                buddy.setConstel(obj.getInt("constel"));
                buddy.setBlood(obj.getInt("blood"));
                buddy.setHomepage(obj.getString("homepage"));
                buddy.setStat(obj.getInt("stat"));
                buddy.setVipLevel(obj.getInt("vip_info")); // VIP等级 0为非VIP
                buddy.setCountry(obj.getString("country"));
                buddy.setCity(obj.getString("city"));
                buddy.setPersonal(obj.getString("personal"));
                buddy.setNickname(obj.getString("nick"));
                buddy.setChineseZodiac(obj.getInt("shengxiao"));
                buddy.setEmail(obj.getString("email"));
                buddy.setProvince(obj.getString("province"));
                buddy.setGender(obj.getString("gender"));
                buddy.setMobile(obj.getString("mobile"));
                if (!obj.isNull("client_type"))
                {
                    //buddy.setClientType(QQClientType.valueOfRaw(obj.getInt("client_type")));
                }
            }

            notifyActionEvent(QQActionEvent.Type.EVT_OK, buddy);
        }