【优化】短信发送ip记录增加127.0.0.1默认设置,防止出现docker下获取ip为空的问题。

This commit is contained in:
jianweie code
2024-08-02 10:53:01 +08:00
parent 4de1ff6021
commit 4593311ec5

View File

@@ -343,7 +343,7 @@ namespace CoreCms.Net.Services
var dt = DateTime.Now;
//获取当前ip今日的发送记录
var ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "";
var ip = _httpContextAccessor.HttpContext?.Connection.RemoteIpAddress != null ? _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString() : "127.0.0.1";
if (string.IsNullOrEmpty(ip))
{
jm.msg = "短信发送IP获取失败";