wet 2 years ago
commit 24fa44bba5

@ -51,7 +51,8 @@ namespace Myshipping.Core.MQ
{ {
base.Dispose(); base.Dispose();
_serviceScope.Dispose(); _serviceScope.Dispose();
mqConn.Close(); if (mqConn != null && mqConn.IsOpen)
mqConn.Close();
_logger.LogInformation("RecCompanyUserChangeService Dispose"); _logger.LogInformation("RecCompanyUserChangeService Dispose");
} }
@ -60,7 +61,7 @@ namespace Myshipping.Core.MQ
{ {
_logger.LogInformation("RecCompanyUserChangeService ExecuteAsync"); _logger.LogInformation("RecCompanyUserChangeService ExecuteAsync");
return Task.Run(async () => return Task.Run(() =>
{ {
_logger.LogInformation("RecCompanyUserChangeService ExecuteAsync RunTask"); _logger.LogInformation("RecCompanyUserChangeService ExecuteAsync RunTask");
@ -68,9 +69,8 @@ namespace Myshipping.Core.MQ
string QueueName = $"djy.comp&user.change.{DateTime.Now.Ticks}"; string QueueName = $"djy.comp&user.change.{DateTime.Now.Ticks}";
ConnectionFactory factory = new ConnectionFactory(); ConnectionFactory factory = new ConnectionFactory();
var cache = _serviceScope.ServiceProvider.GetService<ISysCacheService>(); var repoSysCfg = _serviceScope.ServiceProvider.GetService<SqlSugarRepository<SysConfig>>();
var sysConfig = await cache.GetAllSysConfig(); var mqUrl = repoSysCfg.FirstOrDefault(x => x.Code == "CompanyUserChangeMqUrl").Value;
var mqUrl = sysConfig.First(x => x.Code == "CompanyUserChangeMqUrl").Value;
factory.Uri = new Uri(mqUrl); factory.Uri = new Uri(mqUrl);
mqConn = factory.CreateConnection("客户订舱平台"); mqConn = factory.CreateConnection("客户订舱平台");

@ -85,6 +85,12 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
throw Oops.Oh(ErrorCode.D1017); throw Oops.Oh(ErrorCode.D1017);
//获取对应租户 //获取对应租户
var tenant = _sysTenantRep.Single(user.TenantId); var tenant = _sysTenantRep.Single(user.TenantId);
// 生成Token令牌
return await GetLoginToken(user, tenant);
}
private async Task<string> GetLoginToken(SysUser user, SysTenant tenant)
{
// 生成Token令牌 // 生成Token令牌
//var accessToken = await _jwtBearerManager.CreateTokenAdmin(user); //var accessToken = await _jwtBearerManager.CreateTokenAdmin(user);
var accessToken = JWTEncryption.Encrypt(new Dictionary<string, object> var accessToken = JWTEncryption.Encrypt(new Dictionary<string, object>
@ -360,20 +366,8 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient
throw Oops.Bah($"{showname}不存在,请先加入公司{comname}"); throw Oops.Bah($"{showname}不存在,请先加入公司{comname}");
} }
//var accessToken = JWTEncryption.Encrypt(dic); return await GetLoginToken(user, tenant);
//// 设置Swagger自动登录
//_httpContextAccessor.HttpContext.SigninToSwagger(accessToken);
//// 生成刷新Token令牌
//var refreshToken = JWTEncryption.GenerateRefreshToken(accessToken, 30);
//// 设置刷新Token令牌
//_httpContextAccessor.HttpContext.Response.Headers["x-access-token"] = refreshToken;
//return accessToken;
return null;
} }
else else
{ {

@ -55,7 +55,7 @@
}, },
"Cache": { "Cache": {
"CacheType": "RedisCache", // RedisCache "CacheType": "RedisCache", // RedisCache
"RedisConnectionString": "192.168.0.80:6379,password=,defaultDatabase=11" "RedisConnectionString": "192.168.0.80:6379,password=,defaultDatabase=12"
}, },
"SnowId": { "SnowId": {
"WorkerId": "1" // 0~63,1 "WorkerId": "1" // 0~63,1

Loading…
Cancel
Save