refactor: 移除平台侧能力并收紧租户隔离

This commit is contained in:
root
2026-01-29 12:06:52 +00:00
parent 86ef0d6033
commit 3297ff26ab
124 changed files with 280 additions and 7231 deletions

View File

@@ -1,58 +0,0 @@
using System.Text.Json.Serialization;
using TakeoutSaaS.Domain.Tenants.Enums;
using TakeoutSaaS.Shared.Abstractions.Serialization;
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 租户审核日志 DTO。
/// </summary>
public sealed class TenantAuditLogDto
{
/// <summary>
/// 日志 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long Id { get; init; }
/// <summary>
/// 租户 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long TenantId { get; init; }
/// <summary>
/// 动作。
/// </summary>
public TenantAuditAction Action { get; init; }
/// <summary>
/// 标题。
/// </summary>
public string Title { get; init; } = string.Empty;
/// <summary>
/// 描述。
/// </summary>
public string? Description { get; init; }
/// <summary>
/// 操作人。
/// </summary>
public string? OperatorName { get; init; }
/// <summary>
/// 原状态。
/// </summary>
public TenantStatus? PreviousStatus { get; init; }
/// <summary>
/// 新状态。
/// </summary>
public TenantStatus? CurrentStatus { get; init; }
/// <summary>
/// 创建时间。
/// </summary>
public DateTime CreatedAt { get; init; }
}

View File

@@ -1,27 +0,0 @@
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 租户详情 DTO。
/// </summary>
public sealed class TenantDetailDto
{
/// <summary>
/// 基础信息。
/// </summary>
public TenantDto Tenant { get; init; } = new();
/// <summary>
/// 实名信息。
/// </summary>
public TenantVerificationDto? Verification { get; init; }
/// <summary>
/// 当前订阅。
/// </summary>
public TenantSubscriptionDto? Subscription { get; init; }
/// <summary>
/// 当前套餐详情。
/// </summary>
public TenantPackageDto? Package { get; init; }
}

View File

@@ -1,84 +0,0 @@
using System.Text.Json.Serialization;
using TakeoutSaaS.Domain.Common.Enums;
using TakeoutSaaS.Domain.Tenants.Enums;
using TakeoutSaaS.Shared.Abstractions.Serialization;
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 租户基础信息 DTO。
/// </summary>
public sealed class TenantDto
{
/// <summary>
/// 租户 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long Id { get; init; }
/// <summary>
/// 租户编码。
/// </summary>
public string Code { get; init; } = string.Empty;
/// <summary>
/// 名称。
/// </summary>
public string Name { get; init; } = string.Empty;
/// <summary>
/// 简称。
/// </summary>
public string? ShortName { get; init; }
/// <summary>
/// 联系人。
/// </summary>
public string? ContactName { get; init; }
/// <summary>
/// 联系电话。
/// </summary>
public string? ContactPhone { get; init; }
/// <summary>
/// 邮箱。
/// </summary>
public string? ContactEmail { get; init; }
/// <summary>
/// 当前状态。
/// </summary>
public TenantStatus Status { get; init; }
/// <summary>
/// 实名状态。
/// </summary>
public TenantVerificationStatus VerificationStatus { get; init; }
/// <summary>
/// 经营模式。
/// </summary>
public OperatingMode? OperatingMode { get; init; }
/// <summary>
/// 当前套餐 ID。
/// </summary>
[JsonConverter(typeof(NullableSnowflakeIdJsonConverter))]
public long? CurrentPackageId { get; init; }
/// <summary>
/// 当前订阅有效期开始。
/// </summary>
public DateTime? EffectiveFrom { get; init; }
/// <summary>
/// 当前订阅有效期结束。
/// </summary>
public DateTime? EffectiveTo { get; init; }
/// <summary>
/// 是否自动续费。
/// </summary>
public bool AutoRenew { get; init; }
}

View File

@@ -1,50 +0,0 @@
using TakeoutSaaS.Domain.Tenants.Enums;
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 套餐使用租户 DTO用于平台查看套餐关联租户列表
/// </summary>
public sealed class TenantPackageTenantDto
{
/// <summary>
/// 租户 ID。
/// </summary>
public long TenantId { get; init; }
/// <summary>
/// 租户编码。
/// </summary>
public string Code { get; init; } = string.Empty;
/// <summary>
/// 租户名称。
/// </summary>
public string Name { get; init; } = string.Empty;
/// <summary>
/// 租户状态。
/// </summary>
public TenantStatus Status { get; init; }
/// <summary>
/// 联系人。
/// </summary>
public string? ContactName { get; init; }
/// <summary>
/// 联系电话。
/// </summary>
public string? ContactPhone { get; init; }
/// <summary>
/// 当前订阅生效时间UTC
/// </summary>
public DateTime SubscriptionEffectiveFrom { get; init; }
/// <summary>
/// 当前订阅到期时间UTC
/// </summary>
public DateTime SubscriptionEffectiveTo { get; init; }
}

View File

@@ -1,52 +0,0 @@
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 套餐使用统计 DTO订阅关联数量、使用租户数量
/// </summary>
public sealed class TenantPackageUsageDto
{
/// <summary>
/// 套餐 ID。
/// </summary>
public long TenantPackageId { get; init; }
/// <summary>
/// 当前有效订阅数量(以当前时间为准)。
/// </summary>
public int ActiveSubscriptionCount { get; init; }
/// <summary>
/// 当前使用租户数量(以当前时间为准,按租户去重)。
/// </summary>
public int ActiveTenantCount { get; init; }
/// <summary>
/// 历史总订阅记录数量(不含软删)。
/// </summary>
public int TotalSubscriptionCount { get; init; }
/// <summary>
/// MRRMonthly Recurring Revenue粗看按“当前有效订阅数 × 套餐月付等效价”估算。
/// </summary>
public decimal Mrr { get; init; }
/// <summary>
/// ARRAnnual Recurring Revenue粗看按“当前有效订阅数 × 套餐年付等效价”估算。
/// </summary>
public decimal Arr { get; init; }
/// <summary>
/// 未来 7 天内到期的使用租户数量(按租户去重,以当前时间为准,口径:有效订阅)。
/// </summary>
public int ExpiringTenantCount7Days { get; init; }
/// <summary>
/// 未来 15 天内到期的使用租户数量(按租户去重,以当前时间为准,口径:有效订阅)。
/// </summary>
public int ExpiringTenantCount15Days { get; init; }
/// <summary>
/// 未来 30 天内到期的使用租户数量(按租户去重,以当前时间为准,口径:有效订阅)。
/// </summary>
public int ExpiringTenantCount30Days { get; init; }
}

View File

@@ -1,38 +0,0 @@
using System.Text.Json.Serialization;
using TakeoutSaaS.Shared.Abstractions.Serialization;
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 租户审核领取信息 DTO。
/// </summary>
public sealed class TenantReviewClaimDto
{
/// <summary>
/// 领取记录 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long Id { get; init; }
/// <summary>
/// 租户 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long TenantId { get; init; }
/// <summary>
/// 领取人用户 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long ClaimedBy { get; init; }
/// <summary>
/// 领取人名称。
/// </summary>
public string ClaimedByName { get; init; } = string.Empty;
/// <summary>
/// 领取时间。
/// </summary>
public DateTime ClaimedAt { get; init; }
}

View File

@@ -1,54 +0,0 @@
using System.Text.Json.Serialization;
using TakeoutSaaS.Domain.Tenants.Enums;
using TakeoutSaaS.Shared.Abstractions.Serialization;
namespace TakeoutSaaS.Application.App.Tenants.Dto;
/// <summary>
/// 租户订阅 DTO。
/// </summary>
public sealed class TenantSubscriptionDto
{
/// <summary>
/// 订阅 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long Id { get; init; }
/// <summary>
/// 租户 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long TenantId { get; init; }
/// <summary>
/// 套餐 ID。
/// </summary>
[JsonConverter(typeof(SnowflakeIdJsonConverter))]
public long TenantPackageId { get; init; }
/// <summary>
/// 状态。
/// </summary>
public SubscriptionStatus Status { get; init; }
/// <summary>
/// 生效时间。
/// </summary>
public DateTime EffectiveFrom { get; init; }
/// <summary>
/// 到期时间。
/// </summary>
public DateTime EffectiveTo { get; init; }
/// <summary>
/// 下次扣费时间。
/// </summary>
public DateTime? NextBillingDate { get; init; }
/// <summary>
/// 是否自动续费。
/// </summary>
public bool AutoRenew { get; init; }
}