private async Task <(string Name, int PageCount)> GetTaskNameAsync(CreateType createType, int siteId, int channelId, int contentId, int fileTemplateId, int specialId) { var name = string.Empty; var pageCount = 0; if (createType == CreateType.Channel) { name = channelId == siteId ? "首页" : _channelRepository.GetChannelNameAsync(siteId, channelId).GetAwaiter().GetResult(); if (!string.IsNullOrEmpty(name)) { pageCount = 1; } } else if (createType == CreateType.AllContent) { var site = await _siteRepository.GetAsync(siteId); var channelInfo = await _channelRepository.GetAsync(channelId); if (channelInfo != null) { var count = await _contentRepository.GetCountAsync(site, channelInfo); if (count > 0) { pageCount = count; name = $"{channelInfo.ChannelName}下所有内容页,共 {pageCount} 项"; } } } else if (createType == CreateType.Content) { var site = await _siteRepository.GetAsync(siteId); var content = await _contentRepository.GetAsync(site, channelId, contentId); if (content != null) { if (!string.IsNullOrEmpty(content.Title)) { name = content.Title; pageCount = 1; } } } else if (createType == CreateType.File) { name = await _templateRepository.GetTemplateNameAsync(fileTemplateId); if (!string.IsNullOrEmpty(name)) { pageCount = 1; } } else if (createType == CreateType.Special) { name = await _specialRepository.GetTitleAsync(siteId, specialId); if (!string.IsNullOrEmpty(name)) { pageCount = 1; } } return(name, pageCount); }