From 5d6cb15ac86d9174393cb9d1538d69b567e2c26c Mon Sep 17 00:00:00 2001 From: 移动系统liao <liaoxujun@qq.com> Date: 星期四, 09 五月 2024 08:56:50 +0800 Subject: [PATCH] 修改货品编辑bug --- CoreCms.Net.Web.WebApi/Controllers/UserController.cs | 23 ++++++++++++++++++++++- 1 files changed, 22 insertions(+), 1 deletions(-) diff --git a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs index 6d41ea4..d17603a 100644 --- a/CoreCms.Net.Web.WebApi/Controllers/UserController.cs +++ b/CoreCms.Net.Web.WebApi/Controllers/UserController.cs @@ -402,7 +402,28 @@ return jm; } #endregion - + /// <summary> + /// 鑾峰彇璇锋眰ID + /// </summary> + /// <param name="request"></param> + /// <returns></returns> + [HttpGet] + public async Task<WebApiCallBack> GeiIp([FromServices] IHttpContextAccessor request) + { + string clientIp = request.HttpContext.Connection.RemoteIpAddress.ToString(); + // 濡傛灉瀹㈡埛绔�氳繃浠g悊璁块棶锛屽彲鑳介渶瑕佹鏌-Forwarded-For澶� + if (clientIp == "::1" || clientIp == "127.0.0.1") + { + clientIp = request.HttpContext.Request. Headers["X-Forwarded-For"].FirstOrDefault() + ?? request.HttpContext.Connection.RemoteIpAddress.ToString(); + } + return new WebApiCallBack + { + code = 0, + data = clientIp, + }; + + } #region 寰俊鏍搁獙鏁版嵁骞惰幏鍙栫敤鎴疯缁嗚祫鏂�===================================================== /// <summary> /// 鏍搁獙鏁版嵁骞惰幏鍙栫敤鎴疯缁嗚祫鏂� -- Gitblit v1.9.1