//// custom codes

        /// <summary>
        /// 根据博客id或者标签查询文章列表
        /// </summary>
        /// <param name="input"> </param>
        /// <returns> </returns>
        public async Task <PagedResultDto <PostDetailsDto> > GetListByBlogIdAndTagName(GetPortalBlogsInput input)
        {
            var query = _postManager.QueryPostsAsNoTracking()
                        //模糊搜索地址
                        .WhereIf(!input.FilterText.IsNullOrWhiteSpace(), a => a.Url.Contains(input.FilterText))
                        //模糊搜索封面
                        .WhereIf(!input.FilterText.IsNullOrWhiteSpace(), a => a.CoverImage.Contains(input.FilterText))
                        //模糊搜索标题
                        .WhereIf(!input.FilterText.IsNullOrWhiteSpace(), a => a.Title.Contains(input.FilterText))
                        //模糊搜索内容
                        .WhereIf(!input.FilterText.IsNullOrWhiteSpace(), a => a.Content.Contains(input.FilterText));
            // TODO:根据传入的参数添加过滤条件

            var count = await query.CountAsync();

            var posts = await query.Where(a => a.BlogId == input.BlogId)
                        .OrderByDescending(d => d.CreationTime)
                        .PageBy(input)
                        .ToListAsync();

            var tag = input.TagName.IsNullOrWhiteSpace() ? null : await _tagManager.FindByNameAndBlogIdAsync(input.BlogId, input.TagName);



            var postDtos = ObjectMapper.Map <List <PostDetailsDto> >(posts);



            var userDictionary = new Dictionary <long, UserListDto>();

            foreach (var postDto in postDtos)
            {
                postDto.Tags = await GetTagsOfPost(postDto.Id);

                //获取文章中的评论总数
                postDto.CommentCount = await _commentManager.GetCommentCountOfPostAsync(postDto.Id);

                // 通过文章的创建者userid可以获取关于用户的更多信息

                if (postDto.CreatorUserId.HasValue)
                {
                    if (!userDictionary.ContainsKey(postDto.CreatorUserId.Value))
                    {
                        var tes = AbpSession.TenantId;
                        // AbpSession
                        var creatorUser = await UserManager.Users
                                          .IgnoreQueryFilters()
                                          .FirstOrDefaultAsync(a => a.Id == postDto.CreatorUserId.Value);

                        if (creatorUser != null)
                        {
                            userDictionary[creatorUser.Id] = ObjectMapper.Map <UserListDto>(creatorUser);
                        }
                    }

                    if (userDictionary.ContainsKey(postDto.CreatorUserId.Value))
                    {
                        postDto.Writer = userDictionary[(long)postDto.CreatorUserId];
                    }
                }
            }

            if (tag != null)
            {
                postDtos = await FilterPostsByTag(postDtos, tag);
            }
            return(new PagedResultDto <PostDetailsDto>(count, postDtos));
        }