tangjiang 7 月之前
父节点
当前提交
90b6fd2ab9

+ 20 - 5
src/Hotline.Api/Controllers/ArticleController.cs

@@ -1,4 +1,5 @@
 using DotNetCore.CAP;
+using Hotline.Application.Bulletin;
 using Hotline.Application.FlowEngine;
 using Hotline.Article;
 using Hotline.Caching.Interfaces;
@@ -36,8 +37,23 @@ namespace Hotline.Api.Controllers
         private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
         private readonly IMediator _mediator;
         private readonly ICapPublisher _capPublisher;
-
-        public ArticleController(IRepository<Bulletin> bulletinRepository, IMapper mapper, ISystemDomainService systemDomainService, ISystemOrganizeRepository organizeRepository, IWorkflowApplication workflowApplication, IRepository<Circular> circularRepository, ISessionContext sessionContext, IRepository<CircularRecord> circularRecordRepository, IRepository<CircularReadGroup> circularReadGroupRepository, IRepository<User> userRepository, ICircularRecordDomainService circularRecordDomainService, ISystemDicDataCacheManager systemDicDataCacheManager, IMediator mediator, ICapPublisher capPublisher)
+        private readonly IBulletinApplication _bulletinApplication;
+
+        public ArticleController(IRepository<Bulletin> bulletinRepository,
+            IMapper mapper,
+            ISystemDomainService systemDomainService,
+            ISystemOrganizeRepository organizeRepository,
+            IWorkflowApplication workflowApplication,
+            IRepository<Circular> circularRepository,
+            ISessionContext sessionContext,
+            IRepository<CircularRecord> circularRecordRepository,
+            IRepository<CircularReadGroup> circularReadGroupRepository,
+            IRepository<User> userRepository,
+            ICircularRecordDomainService circularRecordDomainService,
+            ISystemDicDataCacheManager systemDicDataCacheManager,
+            IMediator mediator,
+            ICapPublisher capPublisher,
+            IBulletinApplication bulletinApplication)
         {
             _bulletinRepository = bulletinRepository;
             _mapper = mapper;
@@ -52,6 +68,7 @@ namespace Hotline.Api.Controllers
             _systemDicDataCacheManager = systemDicDataCacheManager;
             _mediator = mediator;
             _capPublisher = capPublisher;
+            _bulletinApplication = bulletinApplication;
         }
         #region 通知
 
@@ -448,10 +465,8 @@ namespace Hotline.Api.Controllers
                 .FirstAsync(x => x.Id == id, HttpContext.RequestAborted);
 
             if (model != null && !string.IsNullOrEmpty(model.Content))
-            {
-                model.Content = model.Content.Replace("&lt;", "<").Replace("&gt;", ">");
+                model.Content = _bulletinApplication.GetSiteUrls(model.Content);
 
-            }
             return _mapper.Map<BulletinDto>(model);
         }
 

+ 1 - 0
src/Hotline.Api/config/appsettings.Development.json

@@ -1,6 +1,7 @@
 {
   "AllowedHosts": "*",
   "AppConfiguration": {
+    "OldFilesUrls": "http://12345.zwfwhfgjjfzj.yibin.gov.cn:81",
     "AppScope": "YiBin",
     "YiBin": {
       "CallCenterType": "TianRun", //XunShi、WeiErXin、TianRun、XingTang

+ 17 - 5
src/Hotline.Application/Bulletin/BulletinApplication.cs

@@ -1,15 +1,24 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using Hotline.Configurations;
+using Microsoft.Extensions.Options;
 using System.Text;
 using System.Text.RegularExpressions;
-using System.Threading.Tasks;
 
 namespace Hotline.Application.Bulletin
 {
     public class BulletinApplication : IBulletinApplication
     {
+        private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
 
+        public BulletinApplication(IOptionsSnapshot<AppConfiguration> appOptions,)
+        {
+            _appOptions = appOptions;
+        }
+
+        /// <summary>
+        /// 处理通知公告图片附件路径
+        /// </summary>
+        /// <param name="sHtmlText"></param>
+        /// <returns></returns>
         public string GetSiteUrls(string sHtmlText)
         {
             sHtmlText = sHtmlText.Replace("&lt;", "<").Replace("&gt;", ">");
@@ -27,8 +36,11 @@ namespace Hotline.Application.Bulletin
             // 搜索匹配的字符串
             MatchCollection matchesvideo = regvideo.Matches(sHtmlText);
 
+
             // 获取服务器地址配置 
-            string strSiteUrl = "OldFilesUrls";// BaseClass.SysBase.e_GetXMLValue("OldFilesUrls");
+            string strSiteUrl = _appOptions.Value.OldFilesUrls;
+            if (string.IsNullOrEmpty(strSiteUrl))
+                strSiteUrl = "http://12345.zwfwhfgjjfzj.yibin.gov.cn:81";
 
             // 取得匹配项列表 视频
             foreach (Match match in matchesvideo)

+ 6 - 0
src/Hotline.Application/Bulletin/IBulletinApplication.cs

@@ -8,5 +8,11 @@ namespace Hotline.Application.Bulletin
 {
     public interface IBulletinApplication
     {
+        /// <summary>
+        /// 处理通知公告图片附件路径
+        /// </summary>
+        /// <param name="sHtmlText"></param>
+        /// <returns></returns>
+        string GetSiteUrls(string sHtmlText);
     }
 }

+ 1 - 0
src/Hotline/Configurations/AppConfiguration.cs

@@ -8,6 +8,7 @@ namespace Hotline.Configurations
 {
     public class AppConfiguration
     {
+        public string OldFilesUrls {  get; set; }
         public string AppScope { get; set; }
         public YiBinConfiguration YiBin { get; set; }
         public ZiGongConfiguration ZiGong { get; set; }