sunpengfei
2025-06-11 e134269d218232c53074aad5860db7419e2aab78
pref:修改前端日志接口
2个文件已修改
17 ■■■■ 已修改文件
LifePayment/LifePayment.Host/LifePaymentService.HttpApi.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/LogController.cs 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>
LifePayment/LifePayment.HttpApi/LifePay/LogController.cs
@@ -1,11 +1,15 @@
using 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($"前端日志(IP-{ip}):{message.ToJson()}");
        }
    }
}