예제 #1
0
        public async Task <string> ParseAsync(Site site, int channelId, int contentId)
        {
            var contentFilePathRule = await _pathManager.GetContentFilePathRuleAsync(site, channelId);

            var contentInfo = await _databaseManager.ContentRepository.GetAsync(site, channelId, contentId);

            var filePath = await ParseContentPathAsync(site, channelId, contentInfo, contentFilePathRule);

            return(filePath);
        }
예제 #2
0
        public async Task <ActionResult <GetResult> > List([FromQuery] SiteRequest request)
        {
            if (!await _authManager.HasSitePermissionsAsync(request.SiteId,
                                                            Types.SitePermissions.SettingsCreateRule))
            {
                return(Unauthorized());
            }

            var site = await _siteRepository.GetAsync(request.SiteId);

            if (site == null)
            {
                return(this.Error("无法确定内容对应的站点"));
            }

            var channel = await _channelRepository.GetAsync(request.SiteId);

            var cascade = await _channelRepository.GetCascadeAsync(site, channel, async summary =>
            {
                var count               = await _contentRepository.GetCountAsync(site, summary);
                var entity              = await _channelRepository.GetAsync(summary.Id);
                var filePath            = await _pathManager.GetInputChannelUrlAsync(site, entity, false);
                var contentFilePathRule = string.IsNullOrEmpty(entity.ContentFilePathRule)
                    ? await _pathManager.GetContentFilePathRuleAsync(site, summary.Id)
                    : entity.ContentFilePathRule;
                return(new
                {
                    entity.IndexName,
                    Count = count,
                    FilePath = filePath,
                    ContentFilePathRule = contentFilePathRule
                });
            });

            return(new GetResult
            {
                Channel = cascade
            });
        }