feat: 套餐管理与配额校验能力
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using MediatR;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
@@ -134,4 +135,21 @@ public sealed class TenantsController(IMediator mediator) : BaseApiController
|
||||
var result = await mediator.Send(query, cancellationToken);
|
||||
return ApiResponse<PagedResult<TenantAuditLogDto>>.Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 配额校验并占用额度(门店/账号/短信/配送)。
|
||||
/// </summary>
|
||||
/// <remarks>需在请求头携带 X-Tenant-Id 对应的租户。</remarks>
|
||||
[HttpPost("{tenantId:long}/quotas/check")]
|
||||
[PermissionAuthorize("tenant:quota:check")]
|
||||
[ProducesResponseType(typeof(ApiResponse<QuotaCheckResultDto>), StatusCodes.Status200OK)]
|
||||
public async Task<ApiResponse<QuotaCheckResultDto>> CheckQuota(
|
||||
long tenantId,
|
||||
[FromBody, Required] CheckTenantQuotaCommand body,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var command = body with { TenantId = tenantId };
|
||||
var result = await mediator.Send(command, cancellationToken);
|
||||
return ApiResponse<QuotaCheckResultDto>.Ok(result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user