From b7d9009ff40429f9ae14bb539760df1e98dfb294 Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Thu, 22 Feb 2024 14:02:51 +0800 Subject: [PATCH] =?UTF-8?q?[=E9=82=AE=E4=BB=B6=E5=8F=91=E9=80=81=EF=BC=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=8A=A8=E6=80=81=E5=85=AC=E5=8F=B8=E5=90=8D?= =?UTF-8?q?=E7=A7=B0]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Progranm.cs | 2 +- IRaCIS.Core.API/appsettings.Prod_IRC.json | 4 ++- IRaCIS.Core.API/appsettings.Test_IRC.json | 4 ++- IRaCIS.Core.API/appsettings.US_IRC.json | 4 ++- IRaCIS.Core.API/appsettings.Uat_IRC.json | 4 ++- .../Service/Common/MailService.cs | 25 ++++++++++++------- IRaCIS.Core.Domain/_Config/_AppSettings.cs | 4 +++ 7 files changed, 33 insertions(+), 14 deletions(-) diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index fbbab47e5..fc92f97ee 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -26,7 +26,7 @@ using IRaCIS.Application.Services.BackGroundJob; using LogDashboard; using OfficeOpenXml.Utils; - +Console.WriteLine("这是一个示例文本,示例文本中会出现示例多次。".Replace("示例", "替换")); #region 获取环境变量 //以配置文件为准,否则 从url中取环境值(服务以命令行传递参数启动,配置文件配置了就不需要传递环境参数) diff --git a/IRaCIS.Core.API/appsettings.Prod_IRC.json b/IRaCIS.Core.API/appsettings.Prod_IRC.json index e811769da..d727b4e79 100644 --- a/IRaCIS.Core.API/appsettings.Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.Prod_IRC.json @@ -51,6 +51,8 @@ "FromEmail": "IRC@extimaging.com", "FromName": "IRC", "AuthorizationCode": "ExtImg@2022", - "SiteUrl": "http://irc.extimaging.com/login" + "SiteUrl": "http://irc.extimaging.com/login", + "CompanyName": "Extensive Imaging", + "CompanyNameCN": "上海展影医疗科技有限公司" } } diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json index 6b46f8159..251a33369 100644 --- a/IRaCIS.Core.API/appsettings.Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.Test_IRC.json @@ -69,7 +69,9 @@ "FromName": "Test_IRC", "AuthorizationCode": "SHzyyl2021", - "SiteUrl": "http://irc.test.extimaging.com/login" + "SiteUrl": "http://irc.test.extimaging.com/login", + "CompanyName": "Extensive Imaging", + "CompanyNameCN": "上海展影医疗科技有限公司" } } diff --git a/IRaCIS.Core.API/appsettings.US_IRC.json b/IRaCIS.Core.API/appsettings.US_IRC.json index e04b507e6..834a44da2 100644 --- a/IRaCIS.Core.API/appsettings.US_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_IRC.json @@ -68,7 +68,9 @@ "Host": "smtp.qiye.aliyun.com", "FromEmail": "test@extimaging.com", "FromName": "Test_IRC", - "AuthorizationCode": "SHzyyl2021" + "AuthorizationCode": "SHzyyl2021", + "CompanyName": "Extensive Imaging", + "CompanyNameCN": "上海展影医疗科技有限公司" } } diff --git a/IRaCIS.Core.API/appsettings.Uat_IRC.json b/IRaCIS.Core.API/appsettings.Uat_IRC.json index 4bd7f8248..2ee6cf6bf 100644 --- a/IRaCIS.Core.API/appsettings.Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.Uat_IRC.json @@ -53,7 +53,9 @@ "FromEmail": "uat@extimaging.com", "FromName": "UAT_IRC", "AuthorizationCode": "SHzyyl2021", - "SiteUrl": "http://irc.uat.extimaging.com/login" + "SiteUrl": "http://irc.uat.extimaging.com/login", + "CompanyName": "Extensive Imaging", + "CompanyNameCN": "上海展影医疗科技有限公司" } diff --git a/IRaCIS.Core.Application/Service/Common/MailService.cs b/IRaCIS.Core.Application/Service/Common/MailService.cs index 7a785f1b7..752d2e666 100644 --- a/IRaCIS.Core.Application/Service/Common/MailService.cs +++ b/IRaCIS.Core.Application/Service/Common/MailService.cs @@ -8,6 +8,7 @@ using AutoMapper; using IRaCIS.Application.Contracts; using Microsoft.Extensions.Options; using Medallion.Threading; +using System.Text.RegularExpressions; namespace IRaCIS.Application.Services { @@ -82,6 +83,12 @@ namespace IRaCIS.Application.Services _distributedLockProvider = distributedLockProvider; } + + private string ReplaceCompanyName(string needDealtxt) + { + return needDealtxt.Replace("{*}", _userInfo.IsEn_Us ? _systemEmailConfig.CompanyName : _systemEmailConfig.CompanyNameCN); + } + //重置邮箱 public async Task SendMailEditEmail(Guid userId, string userName, string emailAddress, int verificationCode) { @@ -112,7 +119,7 @@ namespace IRaCIS.Application.Services var templateInfo = SourceReader.ReadToEnd(); - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), //---尊敬的 _localizer["Mail_Dear", userName], @@ -179,7 +186,7 @@ namespace IRaCIS.Application.Services var templateInfo = SourceReader.ReadToEnd(); - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), "", //---您正在进行邮箱重置密码操作 _localizer["Mail_ResettingPassword"], @@ -247,7 +254,7 @@ namespace IRaCIS.Application.Services var templateInfo = SourceReader.ReadToEnd(); - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), "", //---您正在参与展影医疗IRC项目 _localizer["Mail_IRCProject"], @@ -314,7 +321,7 @@ namespace IRaCIS.Application.Services var templateInfo = SourceReader.ReadToEnd(); - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), "", //---您正在参与展影医疗IRC项目中心调研工作 _localizer["Mail_CenterResearchReminder"], @@ -403,7 +410,7 @@ namespace IRaCIS.Application.Services var templateInfo = SourceReader.ReadToEnd(); - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), sysUserInfo.FullName, sysUserInfo.UserName, sysUserInfo.UserTypeRole.UserTypeShortName, @@ -450,7 +457,7 @@ namespace IRaCIS.Application.Services var templateInfo = SourceReader.ReadToEnd(); - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), sysUserInfo.FullName, sysUserInfo.UserName, sysUserInfo.UserTypeRole.UserTypeShortName, @@ -512,7 +519,7 @@ namespace IRaCIS.Application.Services var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}"; - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), sysUserInfo.FullName, trialInfo.ExperimentName, trialInfo.ResearchProgramNo, @@ -574,7 +581,7 @@ namespace IRaCIS.Application.Services var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}"; - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), sysUserInfo.FullName, trialInfo.ExperimentName, trialInfo.ResearchProgramNo, @@ -696,7 +703,7 @@ namespace IRaCIS.Application.Services var redirectUrl = $"{domain}/api/User/UserRedirect?url={System.Web.HttpUtility.UrlEncode(routeUrl)}"; - builder.HtmlBody = string.Format(templateInfo, + builder.HtmlBody = string.Format(ReplaceCompanyName(templateInfo), sysUserInfo.FullName, trialInfo.ExperimentName, trialInfo.ResearchProgramNo, diff --git a/IRaCIS.Core.Domain/_Config/_AppSettings.cs b/IRaCIS.Core.Domain/_Config/_AppSettings.cs index 698f8a10b..2008be937 100644 --- a/IRaCIS.Core.Domain/_Config/_AppSettings.cs +++ b/IRaCIS.Core.Domain/_Config/_AppSettings.cs @@ -37,6 +37,10 @@ namespace IRaCIS.Core.Domain.Share public string AuthorizationCode { get; set; } public string SiteUrl { get; set; } + + public string CompanyName { get; set; } + + public string CompanyNameCN { get; set; } }