src/ZKEACMS.SectionWidget/EventHandler/UpdateLinkOnPageUrlChangedEventHandler.cs

(完整代码) 1KB

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using System.Linq;
using ZKEACMS.Article.Service;
using ZKEACMS.Event;
using ZKEACMS.Page;
using ZKEACMS.SectionWidget.Service;

namespace ZKEACMS.SectionWidget.EventHandler
{
    public class UpdateLinkOnPageUrlChangedEventHandler : IEventHandler
    {
        private readonly ISectionContentTitleService _sectionContentTitleService;
        private readonly ISectionContentCallToActionService _sectionContentCallToActionService;
        private readonly ISectionContentImageService _sectionContentImageService;

        public UpdateLinkOnPageUrlChangedEventHandler(ISectionContentTitleService sectionContentTitleService, 
            ISectionContentCallToActionService sectionContentCallToActionService, 
            ISectionContentImageService sectionContentImageService)
        {
            _sectionContentTitleService = sectionContentTitleService;
            _sectionContentCallToActionService = sectionContentCallToActionService;
            _sectionContentImageService = sectionContentImageService;
        }

        public void Handle(object entity, EventArg e)
        {
            PageEntity page = entity as PageEntity;
            if (page != null && e.Data != null)
            {
                string oldPageUrl = e.Data.ToString();
                _sectionContentTitleService.UpdateDetailPageUrl(oldPageUrl, page.Url);
                _sectionContentCallToActionService.UpdateDetailPageUrl(oldPageUrl, page.Url);
                _sectionContentImageService.UpdateDetailPageUrl(oldPageUrl, page.Url);
            }
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。