fengling-member-service/src/Fengling.Member.Application/Commands/Points/CalculatePointsCommandHandler.cs
2026-02-09 18:57:52 +08:00

22 lines
691 B
C#

using Fengling.Member.Application.Commands.Points;
using Fengling.Member.Application.Dtos;
using Fengling.Member.Application.Services;
using MediatR;
namespace Fengling.Member.Application.Commands.Points;
public class CalculatePointsCommandHandler : IRequestHandler<CalculatePointsCommand, PointsCalculationResultDto>
{
private readonly PointsRuleMatcher _matcher;
public CalculatePointsCommandHandler(PointsRuleMatcher matcher)
{
_matcher = matcher;
}
public async Task<PointsCalculationResultDto> Handle(CalculatePointsCommand request, CancellationToken cancellationToken)
{
return await _matcher.CalculatePointsAsync(request.CodeInfo);
}
}