/// <summary> /// Get the QQ profile /// </summary> /// <returns></returns> public SmartQQWrapper GetQQProfile() { string url = "http://s.web2.qq.com/api/get_self_info2?t=#{t}".Replace("#{t}", HTTP.AID_TimeStamp()); string dat = HTTP.Get(url, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1"); FriendInfo info = (FriendInfo)JsonConvert.DeserializeObject(dat, typeof(FriendInfo)); if (info.result != null) { smartQQ.Occupation = info.result.occupation; smartQQ.Phone = info.result.phone; smartQQ.College = info.result.college; smartQQ.Blood = info.result.blood; smartQQ.Homepage = info.result.homepage; smartQQ.Country = info.result.country; smartQQ.City = info.result.city; smartQQ.Personal = info.result.personal; smartQQ.Nick = info.result.nick; smartQQ.Email = info.result.email; smartQQ.Province = info.result.province; smartQQ.Gender = info.result.gender; smartQQ.Face = info.result.face; } return(smartQQ); }
/// <summary> /// Load the detailed account profile /// </summary> /// <param name="account"></param> private void LoadAccountDetailedInfo(QQFriendAccount account) { string getFriendInfoUrl = "http://s.web2.qq.com/api/get_friend_info2?tuin=#{uin}&vfwebqq=#{vfwebqq}&clientid=53999199&psessionid=#{psessionid}&t=#{t}".Replace("#{t}", HTTP.AID_TimeStamp()); getFriendInfoUrl = getFriendInfoUrl.Replace("#{uin}", account.Uin).Replace("#{vfwebqq}", smartQQ.VFWebQQ).Replace("#{psessionid}", smartQQ.PSessionId); string retFriendInfo = HTTP.Get(getFriendInfoUrl, "http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1"); FriendInfo friendInfo = (FriendInfo)JsonConvert.DeserializeObject(retFriendInfo, typeof(FriendInfo)); if (friendInfo.result != null) { account.Blood = friendInfo.result.blood; account.Occupation = friendInfo.result.occupation; account.College = friendInfo.result.college; account.Homepage = friendInfo.result.homepage; account.Country = friendInfo.result.country; account.City = friendInfo.result.city; account.Nick = friendInfo.result.nick; account.Email = friendInfo.result.email; account.Phone = friendInfo.result.phone; account.Mobile = friendInfo.result.mobile; account.Province = friendInfo.result.province; account.Gender = friendInfo.result.gender; if (friendInfo.result.birthday.year != 0 && friendInfo.result.birthday.month != 0 && friendInfo.result.birthday.day != 0) { account.Birthday = new DateTime(friendInfo.result.birthday.year, friendInfo.result.birthday.month, friendInfo.result.birthday.day); } } account.Account = GetQQAccountByUin(account.Uin); }
/// <summary> /// 更新自己账户的信息 /// </summary> /// <returns></returns> internal FriendInfo updateSelfAccountInfo() { FriendInfo info = cache.GetValueCache <FriendInfo>(SmartQQStaticString.SelfInfo); if (info == null) { info = ((JObject)client.GetJsonAsync(SmartQQAPI.GetAccountInfo)["result"]).ToObject <FriendInfo>(); } return(info); }
/// <summary> /// 更新好友的详细信息 /// </summary> /// <param name="friend">好友</param> /// <returns></returns> internal FriendInfo updateFriendInfo(Friend friend) { try { FriendInfo info = null; info = cache.GetValueCache <FriendInfo>(friend.Id.ToString()); if (info == null) { JObject jObject = client.GetJsonAsync(SmartQQAPI.GetFriendInfo, friend.Uin, vfwebqq, psessionid); info = jObject["result"].ToObject <FriendInfo>(); cache.UpdateValueCache(friend.Id.ToString(), info, 1800); } return(info); } catch (Exception ex) { Log.Write("更新好友:", friend.Nickname, " ,详细信息失败!"); return(null); } }