网站首页 网站源码
website
站点相关全部源代码,隐藏了一些关于服务器的信息
using System.Threading;
using Dpz.Core.Public.ViewModel.RequestEvent;

namespace Dpz.Core.Service.Event;

public class AddDanmakuCountEvent(IRepository<Video> repository, IBarrageService barrageService)
    : IRequestHandler<AddDanmakuCountRequest>
{
    public async Task Handle(AddDanmakuCountRequest request, CancellationToken cancellationToken)
    {
        var count = await barrageService.GetGroupBarrageCountAsync(request.DanmakuGroup);
        var update = Builders<Video>.Update.Set(x => x.DanmakuCount, count + 1);
        await repository.UpdateAsync(x => x.Id == request.DanmakuGroup, update);
    }
}
loading