diff --git a/Myshipping.Core/Service/Auth/AuthService.cs b/Myshipping.Core/Service/Auth/AuthService.cs index 8316c22..288231d 100644 --- a/Myshipping.Core/Service/Auth/AuthService.cs +++ b/Myshipping.Core/Service/Auth/AuthService.cs @@ -17,6 +17,7 @@ using System.Threading.Tasks; using UAParser; using Furion.RemoteRequest.Extensions; using Newtonsoft.Json.Linq; +using Microsoft.Extensions.Logging; namespace Myshipping.Core.Service; @@ -39,12 +40,14 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient private readonly ISysConfigService _sysConfigService; // 验证码服务 private readonly IEventPublisher _eventPublisher; + private readonly ILogger _logger; public AuthService(SqlSugarRepository sysUserRep, SqlSugarRepository sysLogVisRep, SqlSugarRepository sysTenantRep, IHttpContextAccessor httpContextAccessor, ISysEmpService sysEmpService, ISysRoleService sysRoleService, ISysMenuService sysMenuService, ISysAppService sysAppService, IClickWordCaptcha captchaHandle, ISysConfigService sysConfigService, - IEventPublisher eventPublisher + IEventPublisher eventPublisher, + ILogger logger ) { _sysUserRep = sysUserRep; @@ -58,6 +61,7 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient _captchaHandle = captchaHandle; _sysConfigService = sysConfigService; _eventPublisher = eventPublisher; + _logger = logger; } /// @@ -327,10 +331,15 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient var loginUrl = djyAuthUrl + "user/login"; var infoUrl = djyAuthUrl + "user/info"; + _logger.LogInformation($"统一登录:{loginUrl}"); + //跳转登录 var result = await loginUrl .SetBody(new { code }, "application/json") .PostAsStringAsync(); + + _logger.LogInformation($"登录返回:{result}"); + var jRtn = JObject.Parse(result); if (jRtn.GetIntValue("code") == 200) { @@ -340,13 +349,17 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient var headers = new Dictionary(); headers.Add("Authorization", $"Bearer {token}"); + _logger.LogInformation($"获取登录信息:{infoUrl}"); + //获取登录信息 result = await infoUrl .SetHeaders(headers) .GetAsStringAsync(); + _logger.LogInformation($"登录信息返回:{result}"); jRtn = JObject.Parse(result); if (jRtn.GetIntValue("code") == 200) { + jData = jRtn.GetJObjectValue("data"); var compId = jData.GetStringValue("compId"); @@ -354,13 +367,13 @@ public class AuthService : IAuthService, IDynamicApiController, ITransient var userId = jData.GetStringValue("gid"); var showname = jData.GetStringValue("showname"); - var tenant = _sysTenantRep.FirstOrDefault(x => x.CompId == compId); + var tenant = _sysTenantRep.AsQueryable().Filter(null, true).First(x => x.CompId == compId); if (tenant == null) { throw Oops.Bah($"{comname}不存在,请先完成公司认证!"); } - var user = _sysUserRep.FirstOrDefault(u => u.DjyUserId == userId); + var user = _sysUserRep.AsQueryable().Filter(null, true).First(u => u.DjyUserId == userId); if (tenant == null) { throw Oops.Bah($"{showname}不存在,请先加入公司{comname}!"); diff --git a/Myshipping.Web.Core/applicationconfig.json b/Myshipping.Web.Core/applicationconfig.json index 2b43003..d59432d 100644 --- a/Myshipping.Web.Core/applicationconfig.json +++ b/Myshipping.Web.Core/applicationconfig.json @@ -15,27 +15,27 @@ "InjectSpecificationDocument": true //是否开启swagger }, "SpecificationDocumentSettings": { - "DocumentTitle": "Myshipping", + "DocumentTitle": "客户订舱平台", "DocExpansionState": "None", "GroupOpenApiInfos": [ + { + "Group": "Application", + "Title": "业务模块", + "Description": "业务相关模块", + "Version": "1.0.0" + }, { "Group": "Default", - "Title": "大简云平台", + "Title": "基础模块", "Description": "", "Version": "1.0.0" }, { "Group": "FlowCenter", "Title": "流程中心", - "Description": "流程中心模块或插件。
作者By MonsterUncle,QQ295228902", + "Description": "流程中心模块或插件。", "Version": "1.0.0" }, - { - "Group": "Application", - "Title": "业务模块", - "Description": "独立业务模块", - "Version": "1.0.0" - } ] }, "JWTSettings": {