feat:商户管理

This commit is contained in:
2025-12-29 16:40:27 +08:00
parent 57f4c2d394
commit dd91c1010a
62 changed files with 10536 additions and 165 deletions

View File

@@ -30,6 +30,11 @@ public sealed class TakeoutLogsDbContext(
/// </summary>
public DbSet<MerchantAuditLog> MerchantAuditLogs => Set<MerchantAuditLog>();
/// <summary>
/// 商户变更日志集合。
/// </summary>
public DbSet<MerchantChangeLog> MerchantChangeLogs => Set<MerchantChangeLog>();
/// <summary>
/// 运营操作日志集合。
/// </summary>
@@ -54,6 +59,7 @@ public sealed class TakeoutLogsDbContext(
base.OnModelCreating(modelBuilder);
ConfigureTenantAuditLog(modelBuilder.Entity<TenantAuditLog>());
ConfigureMerchantAuditLog(modelBuilder.Entity<MerchantAuditLog>());
ConfigureMerchantChangeLog(modelBuilder.Entity<MerchantChangeLog>());
ConfigureOperationLog(modelBuilder.Entity<OperationLog>());
ConfigureOperationLogInboxMessage(modelBuilder.Entity<OperationLogInboxMessage>());
ConfigureMemberGrowthLog(modelBuilder.Entity<MemberGrowthLog>());
@@ -75,10 +81,29 @@ public sealed class TakeoutLogsDbContext(
builder.ToTable("merchant_audit_logs");
builder.HasKey(x => x.Id);
builder.Property(x => x.MerchantId).IsRequired();
builder.Property(x => x.Title).HasMaxLength(128).IsRequired();
builder.Property(x => x.Action).HasConversion<int>().IsRequired();
builder.Property(x => x.Title).HasMaxLength(200).IsRequired();
builder.Property(x => x.Description).HasMaxLength(1024);
builder.Property(x => x.OperatorName).HasMaxLength(64);
builder.Property(x => x.OperatorName).HasMaxLength(100);
builder.Property(x => x.IpAddress).HasMaxLength(50);
builder.HasIndex(x => new { x.TenantId, x.MerchantId });
builder.HasIndex(x => new { x.MerchantId, x.CreatedAt });
builder.HasIndex(x => new { x.TenantId, x.CreatedAt });
}
private static void ConfigureMerchantChangeLog(EntityTypeBuilder<MerchantChangeLog> builder)
{
builder.ToTable("merchant_change_logs");
builder.HasKey(x => x.Id);
builder.Property(x => x.MerchantId).IsRequired();
builder.Property(x => x.FieldName).HasMaxLength(100).IsRequired();
builder.Property(x => x.OldValue).HasColumnType("text");
builder.Property(x => x.NewValue).HasColumnType("text");
builder.Property(x => x.ChangeType).HasMaxLength(20).IsRequired();
builder.Property(x => x.ChangedByName).HasMaxLength(100);
builder.Property(x => x.ChangeReason).HasMaxLength(512);
builder.HasIndex(x => new { x.MerchantId, x.CreatedAt });
builder.HasIndex(x => new { x.TenantId, x.CreatedAt });
}
private static void ConfigureOperationLog(EntityTypeBuilder<OperationLog> builder)