Uat_Study
parent
1b3dc192b3
commit
9b7442278f
|
@ -1,13 +1,15 @@
|
|||
using EasyCaching.Core;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace IRaCIS.Core.API
|
||||
{
|
||||
public interface IUploadClient
|
||||
{
|
||||
Task ReceivProgressAsync( string studyInstanceUid , int haveReceivedCount);
|
||||
Task ReceivProgressAsync(string studyInstanceUid, int haveReceivedCount);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,16 +17,23 @@ namespace IRaCIS.Core.API
|
|||
[AllowAnonymous]
|
||||
public class UploadHub : Hub<IUploadClient>
|
||||
{
|
||||
//private IEasyCachingProvider _provider { get; }
|
||||
|
||||
//public UploadHub(IEasyCachingProvider provider)
|
||||
//{
|
||||
// _provider = provider;
|
||||
//}
|
||||
public ILogger<UploadHub> _logger { get; set; }
|
||||
public IUserInfo _userInfo { get; set; }
|
||||
public UploadHub(IUserInfo userInfo, ILogger<UploadHub> logger)
|
||||
{
|
||||
_userInfo = userInfo;
|
||||
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public override Task OnConnectedAsync()
|
||||
{
|
||||
//base.Context.User.id
|
||||
var a = Context.User.Identity;
|
||||
var b = _userInfo.Id;
|
||||
|
||||
_logger.LogError("连接: " + Context.ConnectionId);
|
||||
|
||||
return base.OnConnectedAsync();
|
||||
}
|
||||
|
|
|
@ -228,7 +228,8 @@ namespace IRaCIS.Core.API
|
|||
//文件伺服 必须带Token 访问
|
||||
//app.UseIRacisHostStaticFileStore(env);
|
||||
|
||||
app.UseCors();
|
||||
app.UseCors(t => t.WithOrigins(new string[] { "null" }).AllowAnyMethod().AllowAnyHeader().AllowCredentials());
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapHub<UploadHub>("/UploadHub" ).RequireCors(t=>t.WithOrigins(new string[] {"null"}).AllowAnyMethod().AllowAnyHeader().AllowCredentials());
|
||||
|
|
Loading…
Reference in New Issue