diff --git a/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs b/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs index 08df7bf..d9b9451 100644 --- a/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs +++ b/CoreCms.Net.Services/Bill/CoreCmsBillPaymentsServices.cs @@ -581,7 +581,7 @@ namespace CoreCms.Net.Services billPayments.type = type; billPayments.status = (int)GlobalEnumVars.BillPaymentsStatus.NoPay; billPayments.paymentCode = paymentCode; - billPayments.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString() : "127.0.0.1"; + billPayments.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1"; billPayments.parameters = @params != null ? JsonConvert.SerializeObject(@params) : ""; billPayments.createTime = DateTime.Now; diff --git a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs index 6897c35..5a372e9 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs @@ -225,7 +225,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers var log = new CoreCmsUserLog(); log.userId = user.id; log.state = (int)GlobalEnumVars.UserLogTypes.登录; - log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString() : "127.0.0.1"; + log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1"; log.createTime = DateTime.Now; log.parameters = GlobalEnumVars.UserLogTypes.登录.ToString(); await _userLogServices.InsertAsync(log); @@ -313,7 +313,7 @@ namespace CoreCms.Net.Web.WebApi.Controllers var log = new CoreCmsUserLog(); log.userId = user.id; log.state = (int)GlobalEnumVars.UserLogTypes.登录; - log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString() : "127.0.0.1"; + log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1"; log.createTime = DateTime.Now; log.parameters = GlobalEnumVars.UserLogTypes.登录.ToString(); await _userLogServices.InsertAsync(log); @@ -522,7 +522,8 @@ namespace CoreCms.Net.Web.WebApi.Controllers var log = new CoreCmsUserLog(); log.userId = id; log.state = (int)GlobalEnumVars.UserLogTypes.注册; - log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString() : "127.0.0.1"; + log.ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? + _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1"; log.createTime = DateTime.Now; log.parameters = GlobalEnumVars.UserLogTypes.注册.ToString(); await _userLogServices.InsertAsync(log);