From 754ff29209a140b710c3494f75c5e54dd5310ad4 Mon Sep 17 00:00:00 2001 From: pofi Date: Thu, 16 Mar 2023 17:28:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E8=87=AA=E5=8A=A8=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=85=B7=E4=BD=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.API.Entry/Configurations/Cors.json | 2 +- .../Tnb.API.Entry/Configurations/Logging.json | 27 ++++++++++--------- .../Manager/User/UserManager.cs | 6 ++--- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/apihost/Tnb.API.Entry/Configurations/Cors.json b/apihost/Tnb.API.Entry/Configurations/Cors.json index 3984f7ba..0e26fc64 100644 --- a/apihost/Tnb.API.Entry/Configurations/Cors.json +++ b/apihost/Tnb.API.Entry/Configurations/Cors.json @@ -1,7 +1,7 @@ { "CorsAccessorSettings": { "PolicyName": "JNPFCorsAccessor", - "WithOrigins": [ "http://localhost:3000", "http://localhost:8080" ], + "WithOrigins": [ "http://localhost:9230", "http://localhost:8080" ], "WithExposedHeaders": [ "access-token", "x-access-token", "Content-Disposition" ] } } \ No newline at end of file diff --git a/apihost/Tnb.API.Entry/Configurations/Logging.json b/apihost/Tnb.API.Entry/Configurations/Logging.json index 3cb6d9f0..5ea0b1fb 100644 --- a/apihost/Tnb.API.Entry/Configurations/Logging.json +++ b/apihost/Tnb.API.Entry/Configurations/Logging.json @@ -1,16 +1,17 @@ { - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - }, - "File": { - "Enabled": true, // 启用文件日志 - "FileName": "logs/{0:yyyyMMdd}.log", // 日志文件 - "Append": true, // 追加覆盖 - // "MinimumLevel": "Information", // 日志级别 - "FileSizeLimitBytes": 10485760, // 10M=10*1024*1024 - "MaxRollingFiles": 30 // 只保留30个文件 - } + "Logging": { + "LogLevel": { + "Default": "Debug", + "Microsoft.AspNetCore": "Warning", + "Microsoft.Extensions.Http": "Warning" + }, + "File": { + "Enabled": true, // 启用文件日志 + "FileName": "logs/{0:yyyyMMdd}.log", // 日志文件 + "Append": true, // 追加覆盖 + // "MinimumLevel": "Information", // 日志级别 + "FileSizeLimitBytes": 10485760, // 10M=10*1024*1024 + "MaxRollingFiles": 30 // 只保留30个文件 } + } } \ No newline at end of file diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.cs b/common/Tnb.Common.Core/Manager/User/UserManager.cs index b12faf7a..3f9c44d5 100644 --- a/common/Tnb.Common.Core/Manager/User/UserManager.cs +++ b/common/Tnb.Common.Core/Manager/User/UserManager.cs @@ -206,7 +206,7 @@ public class UserManager : IUserManager, IScoped UserAgent userAgent = new UserAgent(_httpContext); var data = new UserInfoModel(); var ipAddress = NetHelper.Ip; - var ipAddressName = await NetHelper.GetLocation(ipAddress); + //var ipAddressName = await NetHelper.GetLocation(ipAddress); var userDataScope = await GetUserDataScopeAsync(UserId); var sysConfigInfo = await _repository.AsSugarClient().Queryable().FirstAsync(s => s.Category.Equals("SysConfig") && s.Key.ToLower().Equals("tokentimeout")); data = await _repository.AsQueryable().Where(it => it.Id == UserId) @@ -252,8 +252,8 @@ public class UserManager : IUserManager, IScoped data.loginTime = DateTime.Now; data.prevLogin = (await _repository.AsSugarClient().Queryable().FirstAsync(x => x.Category.Equals("SysConfig") && x.Key.ToLower().Equals("lastlogintimeswitch"))).Value.ParseToInt(); data.loginIPAddress = ipAddress; - data.loginIPAddressName = ipAddressName; - data.prevLoginIPAddressName = await NetHelper.GetLocation(data.prevLoginIPAddress); + //data.loginIPAddressName = ipAddressName; + //data.prevLoginIPAddressName = await NetHelper.GetLocation(data.prevLoginIPAddress); data.loginPlatForm = userAgent.RawValue; data.subsidiary = await GetSubsidiaryAsync(data.organizeId, data.isAdministrator); data.subordinates = await this.GetSubordinatesAsync(UserId);