22 lines
691 B
C#
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);
|
|
}
|
|
}
|