Esempio n. 1
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            var json = JObject.Parse(response.GetResponseString());

            if (json["retcode"].ToString() == "0")
            {
                NotifyActionEvent(QQActionEventType.EvtOK, user);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EvtError,
                                  new QQException(QQErrorCode.UnexpectedResponse, response.GetResponseString()));
            }
        }
Esempio n. 2
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject json = JObject.Parse(response.GetResponseString());

            if (json["retcode"].ToString() == "0")
            {
                JObject result = json["result"].ToObject <JObject>();
                QQLevel level  = user.Level;
                level.Level      = result["level"].ToObject <int>();
                level.Days       = result["days"].ToObject <int>();
                level.Hours      = result["hours"].ToObject <int>();
                level.RemainDays = result["remainDays"].ToObject <int>();
                NotifyActionEvent(QQActionEventType.EVT_OK, user);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR,
                                  new QQException(QQErrorCode.UNEXPECTED_RESPONSE, response.GetResponseString()));
            }
        }
Esempio n. 3
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject       json    = JObject.Parse(response.GetResponseString());
            List <object> recents = new List <object>();
            QQStore       store   = Context.Store;

            if (json["retcode"].ToString() == "0")
            {
                JArray result = json["result"].ToObject <JArray>();
                for (int i = 0; i < result.Count; i++)
                {
                    JObject rejson = result[i].ToObject <JObject>();
                    switch (rejson["type"].ToObject <int>())
                    {
                    case 0:
                    {           //好友
                        QQBuddy buddy = store.GetBuddyByUin(rejson["uin"].ToObject <long>());
                        if (buddy != null)
                        {
                            recents.Add(buddy);
                        }
                        break;
                    }

                    case 1:
                    {           //群
                        QQGroup group = store.GetGroupByCode(rejson["uin"].ToObject <long>());
                        if (group != null)
                        {
                            recents.Add(group);
                        }
                        break;
                    }

                    case 2:
                    {           //讨论组
                        QQDiscuz discuz = store.GetDiscuzByDid(rejson["uin"].ToObject <long>());
                        if (discuz != null)
                        {
                            recents.Add(discuz);
                        }
                        break;
                    }
                    }
                }
                NotifyActionEvent(QQActionEventType.EVT_OK, recents);
            }
            else
            {
                NotifyActionEvent(QQActionEventType.EVT_ERROR, new QQException(QQErrorCode.UNEXPECTED_RESPONSE));
            }
        }
Esempio n. 4
0
        public override void OnHttpStatusOK(QQHttpResponse response)
        {
            JObject json = JObject.Parse(response.GetResponseString());

            if (json["retcode"].ToString() == "0")
            {
                JObject obj = json["result"].ToObject <JObject>();
                try
                {
                    buddy.Birthday = DateUtils.Parse(obj["birthday"].ToObject <JObject>());
                }
                catch (FormatException e)
                {
                    MyLogger.Default.Warn($"日期转换失败:{obj["birthday"]}", e);
                    buddy.Birthday = default(DateTime);
                }
                buddy.Occupation = obj["occupation"].ToString();
                buddy.Phone      = obj["phone"].ToString();
                buddy.Allow      = (QQAllow)obj["allow"].ToObject <int>();

                buddy.College = obj["college"].ToString();
                if (obj["reg_time"] != null)
                {
                    buddy.RegTime = obj["reg_time"].ToObject <int>();
                }
                buddy.Uin           = obj["uin"].ToObject <long>();
                buddy.Constel       = obj["constel"].ToObject <int>();
                buddy.Blood         = obj["blood"].ToObject <int>();
                buddy.Homepage      = obj["homepage"].ToString();
                buddy.Stat          = obj["stat"].ToObject <int>();
                buddy.VipLevel      = obj["vip_info"].ToObject <int>(); // VIP等级 0为非VIP
                buddy.Country       = obj["country"].ToString();
                buddy.City          = obj["city"].ToString();
                buddy.Personal      = obj["personal"].ToString();
                buddy.Nickname      = obj["nick"].ToString();
                buddy.ChineseZodiac = obj["shengxiao"].ToObject <int>();
                buddy.Email         = obj["email"].ToString();
                buddy.Province      = obj["province"].ToString();
                buddy.Gender        = obj["gender"].ToString();
                buddy.Mobile        = obj["mobile"].ToString();
                if (obj["client_type"] != null)
                {
                    buddy.ClientType = QQClientType.ValueOfRaw(obj["client_type"].ToObject <int>());
                }
            }

            NotifyActionEvent(QQActionEventType.EVT_OK, buddy);
        }