From a8409b967cebd8e629453a4b04ead4e390cc4d83 Mon Sep 17 00:00:00 2001
From: lingling <kety1122@163.com>
Date: 星期二, 18 三月 2025 15:28:44 +0800
Subject: [PATCH] 添加日志

---
 LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
index fde6a23..c911bc7 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/LifePayController.cs
@@ -2,6 +2,7 @@
 using LifePayment.Domain.Shared;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -20,13 +21,16 @@
     {
         private readonly ILifePayService _lifePayService;
         private readonly IWebClientInfoProvider _webClientInfoProvider;
+        private readonly ILogger<LifePayController> _logger;
         public LifePayController(
               ILifePayService lifePayService,
               IWebClientInfoProvider webClientInfoProvider
+            , ILogger<LifePayController> logger
               )
         {
             _lifePayService = lifePayService;
             _webClientInfoProvider = webClientInfoProvider;
+            _logger = logger;
         }
 
         #region 鏌ヨ
@@ -54,7 +58,8 @@
         {
             var aresResult = await _lifePayService.GetElectricSupportArea();
             var parValues = await _lifePayService.GetElectricParValue();
-
+            CheckExtensions.IfTrueThrowUserFriendlyException(aresResult == null, "鐢佃垂鍏呭�煎尯鍩熶笉瀛樺湪");
+            CheckExtensions.IfTrueThrowUserFriendlyException(parValues == null, "鐢佃垂闈㈤涓嶅瓨鍦�");
             foreach (var item in aresResult.ElectricAreaList)
             {
                 var paritem = parValues.ElectricParValue.Where(r => r.AreaName == item.CityName).FirstOrDefault();
@@ -106,6 +111,20 @@
         }
 
         /// <summary>
+        /// 娣诲姞鏃ュ織
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost]
+        [AllowAnonymous]
+
+        public async Task<int> AddLogger(LogErrorInput input)
+        {
+            Logger.LogError("鍓嶇閿欒锛�" + input.Error);
+            return Constant.SUCCESS;
+        }
+
+
+        /// <summary>
         /// 鑾峰彇鎶樻墸
         /// </summary>
         /// <returns></returns>

--
Gitblit v1.9.1