不自动获取用户具体地址

This commit is contained in:
2023-03-16 17:28:01 +08:00
parent 658466063d
commit 754ff29209
3 changed files with 18 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
{ {
"CorsAccessorSettings": { "CorsAccessorSettings": {
"PolicyName": "JNPFCorsAccessor", "PolicyName": "JNPFCorsAccessor",
"WithOrigins": [ "http://localhost:3000", "http://localhost:8080" ], "WithOrigins": [ "http://localhost:9230", "http://localhost:8080" ],
"WithExposedHeaders": [ "access-token", "x-access-token", "Content-Disposition" ] "WithExposedHeaders": [ "access-token", "x-access-token", "Content-Disposition" ]
} }
} }

View File

@@ -1,8 +1,9 @@
{ {
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Debug",
"Microsoft.AspNetCore": "Warning" "Microsoft.AspNetCore": "Warning",
"Microsoft.Extensions.Http": "Warning"
}, },
"File": { "File": {
"Enabled": true, // 启用文件日志 "Enabled": true, // 启用文件日志

View File

@@ -206,7 +206,7 @@ public class UserManager : IUserManager, IScoped
UserAgent userAgent = new UserAgent(_httpContext); UserAgent userAgent = new UserAgent(_httpContext);
var data = new UserInfoModel(); var data = new UserInfoModel();
var ipAddress = NetHelper.Ip; var ipAddress = NetHelper.Ip;
var ipAddressName = await NetHelper.GetLocation(ipAddress); //var ipAddressName = await NetHelper.GetLocation(ipAddress);
var userDataScope = await GetUserDataScopeAsync(UserId); var userDataScope = await GetUserDataScopeAsync(UserId);
var sysConfigInfo = await _repository.AsSugarClient().Queryable<SysConfigEntity>().FirstAsync(s => s.Category.Equals("SysConfig") && s.Key.ToLower().Equals("tokentimeout")); var sysConfigInfo = await _repository.AsSugarClient().Queryable<SysConfigEntity>().FirstAsync(s => s.Category.Equals("SysConfig") && s.Key.ToLower().Equals("tokentimeout"));
data = await _repository.AsQueryable().Where(it => it.Id == UserId) data = await _repository.AsQueryable().Where(it => it.Id == UserId)
@@ -252,8 +252,8 @@ public class UserManager : IUserManager, IScoped
data.loginTime = DateTime.Now; data.loginTime = DateTime.Now;
data.prevLogin = (await _repository.AsSugarClient().Queryable<SysConfigEntity>().FirstAsync(x => x.Category.Equals("SysConfig") && x.Key.ToLower().Equals("lastlogintimeswitch"))).Value.ParseToInt(); data.prevLogin = (await _repository.AsSugarClient().Queryable<SysConfigEntity>().FirstAsync(x => x.Category.Equals("SysConfig") && x.Key.ToLower().Equals("lastlogintimeswitch"))).Value.ParseToInt();
data.loginIPAddress = ipAddress; data.loginIPAddress = ipAddress;
data.loginIPAddressName = ipAddressName; //data.loginIPAddressName = ipAddressName;
data.prevLoginIPAddressName = await NetHelper.GetLocation(data.prevLoginIPAddress); //data.prevLoginIPAddressName = await NetHelper.GetLocation(data.prevLoginIPAddress);
data.loginPlatForm = userAgent.RawValue; data.loginPlatForm = userAgent.RawValue;
data.subsidiary = await GetSubsidiaryAsync(data.organizeId, data.isAdministrator); data.subsidiary = await GetSubsidiaryAsync(data.organizeId, data.isAdministrator);
data.subordinates = await this.GetSubordinatesAsync(UserId); data.subordinates = await this.GetSubordinatesAsync(UserId);