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

namespace Dpz.Core.Web.Library.Hub
{
    public class BarrageHub:Microsoft.AspNetCore.SignalR.Hub
    {
        private readonly IBarrageService _barrageService;

        public BarrageHub(IBarrageService barrageService)
        {
            _barrageService = barrageService;
        }
        
        public async Task Send(VmBarrage barrage)
        {
            if (string.IsNullOrEmpty(barrage?.Text)) return;
            await Clients.All.SendCoreAsync("ReceiveMessage", new object[] {barrage});
            barrage.SendTime = DateTime.Now;
            await _barrageService.AddBarrageAsync(barrage);
        }
    }
}
loading