public async Task <ResponseViewModel <FriendListViewModel> > Handle(GetFriendsCommand request, CancellationToken cancellationToken)
        {
            var query = _query.GetAllAsync(request.Search, request.Sort, request.Order, request.Page, request.Size);

            var result = await _mapper.ProjectTo <FriendListViewModel>(query).ToListAsync(cancellationToken: cancellationToken);

            var count = await _query.CountAsync(request.Search, cancellationToken);

            return(new ResponseViewModel <FriendListViewModel>(count, result));
        }
        public async Task <BodyResponse <FriendVM> > Handle(GetFriendsCommand request, CancellationToken cancellationToken)
        {
            var info = await _redis.GetFriendInfo(request.Id);

            if (info == null)
            {
                info = await _friendRepository.GetByIdAsync(request.Id);

                using (var locker = _redis.Locker(KeyGenHelper.GenUserKey(request.Id, "FriendInfo")))
                {
                    await _redis.SetFriendInfo(info);
                }
            }
            if (info == null)
            {
                return(new BodyResponse <FriendVM>(StatusCodeDefines.Success));
            }

            List <Task <Response <BodyResponse <GetAccountBaseInfoMqResponse> > > > getTasks =
                new List <Task <Response <BodyResponse <GetAccountBaseInfoMqResponse> > > >();

            foreach (var oneFriend in info._friends)
            {
                //获取好友信息
                getTasks.Add(_mqCleint.GetResponseExt <GetAccountBaseInfoMqCommand, BodyResponse <GetAccountBaseInfoMqResponse> >
                                 (new GetAccountBaseInfoMqCommand(oneFriend.Key)));
            }
            var allTask = await Task.WhenAll(getTasks);

            FriendVM friendInfos = new FriendVM()
            {
                Friends = new List <OneFriendVM>()
            };

            foreach (var one in allTask)
            {
                var response = one.Message;
                if (response.StatusCode == StatusCodeDefines.Success)
                {
                    var friendType = info._friends[response.Body.Id].Type;
                    friendInfos.Friends.Add(new OneFriendVM(response.Body.Id, response.Body.PlatformAccount, response.Body.UserName,
                                                            response.Body.Sex, response.Body.HeadUrl, response.Body.Type, friendType));
                }
            }

            return(new BodyResponse <FriendVM>(StatusCodeDefines.Success, null, friendInfos));
        }
        public async Task <IActionResult> Get([FromQuery] GetFriendsCommand command)
        {
            var result = await _mediator.Send(command);

            return(Ok(result));
        }