feat: 租户冻结解冻与订阅延期接口

This commit is contained in:
2025-12-15 13:44:47 +08:00
parent f2ec40a533
commit d64545dd26
7 changed files with 407 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using MediatR;
using System.ComponentModel.DataAnnotations;
using TakeoutSaaS.Application.App.Tenants.Dto;
namespace TakeoutSaaS.Application.App.Tenants.Commands;
/// <summary>
/// 延期/赠送租户订阅时长(按当前订阅套餐续费)。
/// </summary>
public sealed record ExtendTenantSubscriptionCommand : IRequest<TenantSubscriptionDto>
{
/// <summary>
/// 租户 ID雪花算法
/// </summary>
[Required]
public long TenantId { get; init; }
/// <summary>
/// 赠送/延期时长(月)。
/// </summary>
[Range(1, 120)]
public int DurationMonths { get; init; }
/// <summary>
/// 备注信息。
/// </summary>
[MaxLength(256)]
public string? Notes { get; init; }
}

View File

@@ -0,0 +1,25 @@
using MediatR;
using System.ComponentModel.DataAnnotations;
using TakeoutSaaS.Application.App.Tenants.Dto;
namespace TakeoutSaaS.Application.App.Tenants.Commands;
/// <summary>
/// 冻结租户(将租户状态置为暂停)。
/// </summary>
public sealed record FreezeTenantCommand : IRequest<TenantDto>
{
/// <summary>
/// 租户 ID雪花算法
/// </summary>
[Required]
public long TenantId { get; init; }
/// <summary>
/// 冻结原因。
/// </summary>
[Required]
[MaxLength(256)]
public string Reason { get; init; } = string.Empty;
}

View File

@@ -0,0 +1,24 @@
using MediatR;
using System.ComponentModel.DataAnnotations;
using TakeoutSaaS.Application.App.Tenants.Dto;
namespace TakeoutSaaS.Application.App.Tenants.Commands;
/// <summary>
/// 解冻租户(恢复租户状态)。
/// </summary>
public sealed record UnfreezeTenantCommand : IRequest<TenantDto>
{
/// <summary>
/// 租户 ID雪花算法
/// </summary>
[Required]
public long TenantId { get; init; }
/// <summary>
/// 解冻备注(可选)。
/// </summary>
[MaxLength(256)]
public string? Reason { get; init; }
}