From e134269d218232c53074aad5860db7419e2aab78 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期三, 11 六月 2025 16:22:07 +0800
Subject: [PATCH] pref:修改前端日志接口
---
LifePayment/LifePayment.HttpApi/LifePay/LogController.cs | 15 ++++++++++++---
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml | 2 +-
2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
index d1a134c..c7324dc 100644
--- a/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
+++ b/LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml
@@ -513,7 +513,7 @@
<param name="input"></param>
<returns></returns>
</member>
- <member name="M:LifePayment.HttpApi.LifePay.LogController.LogFront(System.String)">
+ <member name="M:LifePayment.HttpApi.LifePay.LogController.LogFront(LifePayment.Domain.Shared.LogFrontInput)">
<summary>
璁板綍鍓嶇鏃ュ織
</summary>
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LogController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LogController.cs
index 80a0153..33d74d0 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LogController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LogController.cs
@@ -1,11 +1,15 @@
锘縰sing Castle.Core.Logging;
using LifePayment.Application.Sync;
+using LifePayment.Domain.Shared;
using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using Volo.Abp.AspNetCore.Mvc;
+using ZeroD.Util;
namespace LifePayment.HttpApi.LifePay
{
@@ -14,10 +18,14 @@
public class LogController : AbpController
{
private readonly ILogger<LogController> logger;
+ private readonly IHttpContextAccessor httpContextAccessor;
- public LogController(ILogger<LogController> logger)
+ public LogController(
+ ILogger<LogController> logger,
+ IHttpContextAccessor httpContextAccessor)
{
this.logger = logger;
+ this.httpContextAccessor = httpContextAccessor;
}
/// <summary>
@@ -25,9 +33,10 @@
/// </summary>
/// <returns></returns>
[HttpPost]
- public void LogFront(string message)
+ public void LogFront(LogFrontInput message)
{
- logger.LogInformation($"鍓嶇鏃ュ織锛歿message}");
+ string ip = httpContextAccessor.HttpContext?.Connection?.RemoteIpAddress?.ToString();
+ logger.LogInformation($"鍓嶇鏃ュ織锛圛P-{ip}锛夛細{message.ToJson()}");
}
}
}
--
Gitblit v1.9.1