feat: 租户冻结解冻与订阅延期接口
This commit is contained in:
@@ -188,6 +188,50 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
return ApiResponse<TenantReviewClaimDto?>.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 冻结租户(暂停服务)。
|
||||
/// </summary>
|
||||
/// <returns>冻结后的租户信息。</returns>
|
||||
[HttpPost("{tenantId:long}/freeze")]
|
||||
[PermissionAuthorize("tenant:review")]
|
||||
[ProducesResponseType(typeof(ApiResponse<TenantDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<TenantDto>> Freeze(
|
||||
long tenantId,
|
||||
[FromBody] FreezeTenantCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 合并路由参数
|
||||
var command = body with { TenantId = tenantId };
|
||||
|
||||
// 2. 执行冻结
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
|
||||
// 3. 返回冻结结果
|
||||
return ApiResponse<TenantDto>.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解冻租户(恢复服务)。
|
||||
/// </summary>
|
||||
/// <returns>解冻后的租户信息。</returns>
|
||||
[HttpPost("{tenantId:long}/unfreeze")]
|
||||
[PermissionAuthorize("tenant:review")]
|
||||
[ProducesResponseType(typeof(ApiResponse<TenantDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<TenantDto>> Unfreeze(
|
||||
long tenantId,
|
||||
[FromBody] UnfreezeTenantCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 合并路由参数
|
||||
var command = body with { TenantId = tenantId };
|
||||
|
||||
// 2. 执行解冻
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
|
||||
// 3. 返回解冻结果
|
||||
return ApiResponse<TenantDto>.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建或续费租户订阅。
|
||||
/// </summary>
|
||||
@@ -208,6 +252,28 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
return ApiResponse<TenantSubscriptionDto>.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 延期/赠送租户订阅时长(按当前订阅套餐续费)。
|
||||
/// </summary>
|
||||
/// <returns>续费后的订阅信息。</returns>
|
||||
[HttpPost("{tenantId:long}/subscriptions/extend")]
|
||||
[PermissionAuthorize("tenant:subscription")]
|
||||
[ProducesResponseType(typeof(ApiResponse<TenantSubscriptionDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<TenantSubscriptionDto>> ExtendSubscription(
|
||||
long tenantId,
|
||||
[FromBody] ExtendTenantSubscriptionCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
// 1. 合并租户标识
|
||||
var command = body with { TenantId = tenantId };
|
||||
|
||||
// 2. 执行延期/赠送
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
|
||||
// 3. 返回订阅结果
|
||||
return ApiResponse<TenantSubscriptionDto>.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 套餐升降配。
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user