/// <summary> /// 对GetContentUrlByID的优化 /// 通过传入参数contentInfoCurrent,避免对ContentInfo查询太多 /// </summary> private static string GetContentUrlById(PublishmentSystemInfo publishmentSystemInfo, ContentInfo contentInfoCurrent, int sourceId, int referenceId, string linkUrl, bool isFromBackground) { var nodeId = contentInfoCurrent.NodeId; if (referenceId > 0 && contentInfoCurrent.GetExtendedAttribute(ContentAttribute.TranslateContentType) != ETranslateContentType.ReferenceContent.ToString()) { if (sourceId > 0 && (NodeManager.IsExists(publishmentSystemInfo.PublishmentSystemId, sourceId) || NodeManager.IsExists(sourceId))) { var targetNodeId = sourceId; var targetPublishmentSystemId = DataProvider.NodeDao.GetPublishmentSystemId(targetNodeId); var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemId); var targetNodeInfo = NodeManager.GetNodeInfo(targetPublishmentSystemId, targetNodeId); var tableStyle = NodeManager.GetTableStyle(targetPublishmentSystemInfo, targetNodeInfo); var tableName = NodeManager.GetTableName(targetPublishmentSystemInfo, targetNodeInfo); var contentInfo = DataProvider.ContentDao.GetContentInfo(tableStyle, tableName, referenceId); if (contentInfo == null || contentInfo.NodeId <= 0) { return(PageUtils.UnclickedUrl); } if (contentInfo.PublishmentSystemId == targetPublishmentSystemInfo.PublishmentSystemId) { return(GetContentUrlById(targetPublishmentSystemInfo, contentInfo, contentInfo.SourceId, contentInfo.ReferenceId, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.LinkUrl), isFromBackground)); } var publishmentSystemInfoTmp = PublishmentSystemManager.GetPublishmentSystemInfo(contentInfo.PublishmentSystemId); return(GetContentUrlById(publishmentSystemInfoTmp, contentInfo, contentInfo.SourceId, contentInfo.ReferenceId, contentInfo.GetExtendedAttribute(BackgroundContentAttribute.LinkUrl), isFromBackground)); } else { var tableName = NodeManager.GetTableName(publishmentSystemInfo, nodeId); nodeId = BaiRongDataProvider.ContentDao.GetNodeId(tableName, referenceId); linkUrl = BaiRongDataProvider.ContentDao.GetValue(tableName, referenceId, BackgroundContentAttribute.LinkUrl); if (NodeManager.IsExists(publishmentSystemInfo.PublishmentSystemId, nodeId)) { return(GetContentUrlById(publishmentSystemInfo, nodeId, referenceId, 0, 0, linkUrl, isFromBackground)); } var targetPublishmentSystemId = DataProvider.NodeDao.GetPublishmentSystemId(nodeId); var targetPublishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(targetPublishmentSystemId); return(GetContentUrlById(targetPublishmentSystemInfo, nodeId, referenceId, 0, 0, linkUrl, isFromBackground)); } } if (!string.IsNullOrEmpty(linkUrl)) { return(ParseNavigationUrl(publishmentSystemInfo, linkUrl, isFromBackground)); } var contentUrl = PathUtility.ContentFilePathRules.Parse(publishmentSystemInfo, nodeId, contentInfoCurrent); return(GetPublishmentSystemUrl(publishmentSystemInfo, contentUrl, isFromBackground)); }