添加邮件日志表
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a7fbd00530
commit
75d3908911
|
|
@ -13,6 +13,9 @@ using MailKit.Search;
|
|||
using MailKit.Security;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
|
@ -68,7 +71,7 @@ namespace IRaCIS.Core.Application.Contracts
|
|||
foreach (var uid in uids.Take(10))
|
||||
{
|
||||
var message = sentFolder.GetMessage(uid);
|
||||
|
||||
|
||||
// 输出邮件基本信息
|
||||
Console.WriteLine($"主题: {message.Subject}");
|
||||
Console.WriteLine($"收件人: {string.Join(", ", message.To.Mailboxes.Select(m => m.Address))}");
|
||||
|
|
|
|||
|
|
@ -24,6 +24,24 @@ namespace IRaCIS.Core.Domain.Share
|
|||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public enum EmailState
|
||||
{
|
||||
/// <summary>
|
||||
/// 成功
|
||||
/// </summary>
|
||||
Success = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 失败
|
||||
/// </summary>
|
||||
Error = 1,
|
||||
|
||||
}
|
||||
|
||||
public enum GenerateTaskCategory
|
||||
|
|
|
|||
|
|
@ -0,0 +1,60 @@
|
|||
using IRaCIS.Core.Domain.Share;
|
||||
|
||||
namespace IRaCIS.Core.Domain.Models;
|
||||
|
||||
[Comment("邮件日志")]
|
||||
[Table("EmailLog")]
|
||||
public class EmailLog : BaseFullAuditEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 邮件Id
|
||||
/// </summary>
|
||||
public string MessageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 唯一Id
|
||||
/// </summary>
|
||||
public string UniqueId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮件主题
|
||||
/// </summary>
|
||||
public string EmailSubject { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 收件人
|
||||
/// </summary>
|
||||
public List<string> ToRecipients { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 抄送人
|
||||
/// </summary>
|
||||
public List<string> CcRecipients { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附件
|
||||
/// </summary>
|
||||
public List<string> Attachments { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 日期
|
||||
/// </summary>
|
||||
public DateTime? EmailDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
public string ErrorInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发件人地址
|
||||
/// </summary>
|
||||
public string SenderAddress { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮件状态
|
||||
/// </summary>
|
||||
public EmailState EmailStateEnum { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -555,6 +555,8 @@ public class IRaCISDBContext : DbContext
|
|||
|
||||
#region 未分类
|
||||
|
||||
public virtual DbSet<EmailLog> EmailLog { get; set; }
|
||||
|
||||
public virtual DbSet<ShortcutKey> ShortcutKey { get; set; }
|
||||
|
||||
public virtual DbSet<UserWLTemplate> UserWLTemplate { get; set; }
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class EmailLog : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "EmailLog",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
MessageId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||
UniqueId = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||
EmailSubject = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||
ToRecipients = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CcRecipients = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Attachments = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
EmailDate = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
ErrorInfo = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||
SenderAddress = table.Column<string>(type: "nvarchar(400)", maxLength: 400, nullable: false),
|
||||
EmailStateEnum = table.Column<int>(type: "int", nullable: false),
|
||||
CreateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
CreateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
UpdateUserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
UpdateTime = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_EmailLog", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_EmailLog_User_CreateUserId",
|
||||
column: x => x.CreateUserId,
|
||||
principalTable: "User",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
},
|
||||
comment: "邮件日志");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_EmailLog_CreateUserId",
|
||||
table: "EmailLog",
|
||||
column: "CreateUserId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "EmailLog");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2300,6 +2300,76 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Attachments")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("CcRecipients")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("CreateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("CreateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime?>("EmailDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("EmailStateEnum")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("EmailSubject")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("ErrorInfo")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("MessageId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("SenderAddress")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<string>("ToRecipients")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UniqueId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(400)
|
||||
.HasColumnType("nvarchar(400)");
|
||||
|
||||
b.Property<DateTime>("UpdateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("UpdateUserId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreateUserId");
|
||||
|
||||
b.ToTable("EmailLog", t =>
|
||||
{
|
||||
t.HasComment("邮件日志");
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
|
|
@ -16369,6 +16439,17 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.Navigation("CreateUserRole");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailLog", b =>
|
||||
{
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreateUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CreateUserRole");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.EmailNoticeConfig", b =>
|
||||
{
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "CreateUserRole")
|
||||
|
|
|
|||
Loading…
Reference in New Issue