/// <summary>
        /// 根据词条Id获取词条名
        /// </summary>
        /// <returns>
        /// 词条Id
        /// </returns>
        protected override string GetTitleByPageId(long pageId)
        {
            WikiPage wikiPage = wikiPageRepository.Get(pageId);

            if (wikiPage != null)
            {
                return(wikiPage.Title);
            }
            return(null);
        }
Пример #2
0
        /// <summary>
        /// 加精/取消精华
        /// </summary>
        /// <param name="pageId">词条Id</param>
        /// <param name="isEssential">是否设为精华</param>
        public void SetEssential(long pageId, bool isEssential)
        {
            WikiPage wikiPage = wikiPageRepository.Get(pageId);

            if (wikiPage == null)
            {
                return;
            }

            if (wikiPage.IsEssential == isEssential)
            {
                return;
            }

            wikiPage.IsEssential = isEssential;
            wikiPageRepository.Update(wikiPage);

            string operationType = isEssential ? EventOperationType.Instance().SetEssential() : EventOperationType.Instance().CancelEssential();

            EventBus <WikiPage> .Instance().OnAfter(wikiPage, new CommonEventArgs(operationType));
        }