Test_IRC_Net8
he 2025-10-28 09:37:49 +08:00
parent 5bd055c77d
commit 121b1d4eb4
3 changed files with 69 additions and 8 deletions

View File

@ -9438,7 +9438,7 @@
融合的CTSeriesId
</summary>
</member>
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ChangePlottingScaleChangeAnswerInDto.MarkId">
<member name="P:IRaCIS.Core.Application.Service.Reading.Dto.ChangePlottingScaleChangeAnswerInDto.NoneDicomFileId">
<summary>
标记id
</summary>
@ -16549,11 +16549,17 @@
系统邮件配置表
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeUserType},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.#ctor(IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeConfig},IRaCIS.Core.Infra.EFCore.IRepository{IRaCIS.Core.Domain.Models.EmailNoticeUserType},Microsoft.Extensions.Options.IOptionsMonitor{IRaCIS.Core.Domain.Share.SystemEmailSendConfig},AutoMapper.IMapper,IRaCIS.Core.Domain.Share.IUserInfo,Microsoft.Extensions.Localization.IStringLocalizer)">
<summary>
系统邮件配置表
</summary>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.GetEmailList">
<summary>
获取邮件列表
</summary>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Contracts.EmailNoticeConfigService.BatchUpdateEmail(System.Collections.Generic.List{IRaCIS.Core.Application.Contracts.BatchUpdateEmailTopicCommand})">
<summary>
批量更新邮件主题中英文

View File

@ -4,9 +4,14 @@
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using DocumentFormat.OpenXml.Spreadsheet;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Domain.Share;
using MailKit;
using MailKit.Net.Imap;
using MailKit.Search;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using NPOI.SS.Formula.Functions;
using System.Text.RegularExpressions;
@ -17,8 +22,56 @@ namespace IRaCIS.Core.Application.Contracts
/// </summary>
[ApiExplorerSettings(GroupName = "Common")]
public class EmailNoticeConfigService(IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
IRepository<EmailNoticeUserType> _emailNoticeUserTypeRepository, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEmailNoticeConfigService
IRepository<EmailNoticeUserType> _emailNoticeUserTypeRepository,
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IEmailNoticeConfigService
{
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
/// <summary>
/// 获取邮件列表
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<object> GetEmailList()
{
List<IMessageSummary> emailList = new List<IMessageSummary>();
using var client = new ImapClient();
await client.ConnectAsync(_systemEmailConfig.Host, 993, true);
await client.AuthenticateAsync(_systemEmailConfig.FromEmail, _systemEmailConfig.AuthorizationCode);
var personal = client.GetFolder(client.PersonalNamespaces[0]);
var sent = personal.GetSubfolders()
.First(f => new[] { "已发送邮件", "Sent", "Sent Messages" }
.Contains(f.Name, StringComparer.OrdinalIgnoreCase));
await sent.OpenAsync(FolderAccess.ReadOnly);
List<object> list= new List<object>();
for (int i = 0; i < sent.Count; i++)
{
var msg = await sent.GetMessageAsync(i);
list.Add(new {
Subject= msg.Subject,
From= msg.From.ToString(),
To = msg.To.ToString(),
TextBody = msg.TextBody ?? "",
HtmlBody = msg.HtmlBody ?? "",
Date = msg.Date.UtcDateTime
});
}
await client.DisconnectAsync(true);
return list;
}
[HttpPost]
public async Task<PageOutput<EmailNoticeConfigView>> GetEmailNoticeConfigList(EmailNoticeConfigQuery inQuery)

View File

@ -5,9 +5,13 @@ using IRaCIS.Core.Domain.Models;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
using MailKit;
using MailKit.Net.Imap;
using MailKit.Search;
using MailKit.Security;
using Medallion.Threading;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using MimeKit;
using System.Net.Mail;
@ -74,7 +78,7 @@ namespace IRaCIS.Core.Application.Service
Task AfterUserModifyPasswordSendEmailAsync(Guid userId);
}
[ApiExplorerSettings(GroupName = "Common")]
public class MailVerificationService(IRepository<VerificationCode> _verificationCodeRepository,
IRepository<SystemBasicData> _systemBasicDatarepository,
IRepository<VisitTask> _visitTaskRepository,
@ -89,16 +93,14 @@ namespace IRaCIS.Core.Application.Service
IRepository<UserType> _userTypeRepository,
IRepository<Doctor> _doctorTypeRepository,
IRepository<Dictionary> _dictionaryRepository,
IRepository<EmailNoticeConfig> _emailNoticeConfigrepository,
IOptionsMonitor<SystemEmailSendConfig> systemEmailConfig,
IDistributedLockProvider _distributedLockProvider, IMapper _mapper, IUserInfo _userInfo, IStringLocalizer _localizer) : BaseService, IMailVerificationService
{
private readonly SystemEmailSendConfig _systemEmailConfig = systemEmailConfig.CurrentValue;
//public async Task<object> GetEmailList()
//{
//}
private async Task<EmailNoticeConfig> GetEmailSubejctAndHtmlInfoAndBuildAsync(EmailBusinessScenario scenario, MimeMessage messageToSend,
Func<(string topicStr, string htmlBodyStr), (string topicStr, string htmlBodyStr)> emailFunc)