Ejemplo n.º 1
0
        public string GetFriendInfo()
        {
            GetFriendInfoParams actionParams = JavaScriptConvert.DeserializeObject <GetFriendInfoParams>(JsonParams);

            ShortUserInfo shortInfo = Forum.Users.GetShortUserInfo(actionParams.Uid);
            UserInfo      user      = new UserInfo();

            user.Uid      = shortInfo.Uid;
            user.UserName = shortInfo.Username;

            GetFriendInfoResponse gfiResponse = new GetFriendInfoResponse();

            gfiResponse.TotalNum = Forum.Friendship.GetUserFriendsCount(user.Uid);
            gfiResponse.Me       = user;

            List <FriendshipInfo> friendshipList = Friendship.GetUserFriendsList(user.Uid, 1, actionParams.ShowFriendsNum);
            List <Friend>         friendList     = new List <Friend>();

            foreach (FriendshipInfo info in friendshipList)
            {
                friendList.Add(new Friend(info.FriendUid, info.FriendUserName.Trim()));
            }

            gfiResponse.Friends = friendList;

            return(GetResult(gfiResponse));
        }
Ejemplo n.º 2
0
        private string[] GetUserFriendList(int uid, int count)
        {
            List <FriendshipInfo> friendshipList = Friendship.GetUserFriendsList(uid, 1, count);
            List <string>         resultList     = new List <string>();

            foreach (FriendshipInfo info in friendshipList)
            {
                resultList.Add(info.FriendUid.ToString());
            }

            return(resultList.ToArray());
        }
Ejemplo n.º 3
0
        public string Get()
        {
            GetFriendsParams        actionParams    = JavaScriptConvert.DeserializeObject <GetFriendsParams>(JsonParams);
            Dictionary <int, int[]> friendListTable = new Dictionary <int, int[]>();

            foreach (int uid in actionParams.UIds)
            {
                List <int>            friendUidList  = new List <int>();
                List <FriendshipInfo> friendshipList = Friendship.GetUserFriendsList(uid, 1, actionParams.FriendNum);

                foreach (FriendshipInfo friendUid in friendshipList)
                {
                    friendUidList.Add(friendUid.FriendUid);
                }

                friendListTable.Add(uid, friendUidList.ToArray());
            }

            return(GetResult(friendListTable));
        }