From fa48f8996e9e829bc9352863596011d1e0e95490 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期二, 10 六月 2025 16:32:25 +0800
Subject: [PATCH] fix:运营端——渠道管理——渠道管理(渠道折扣接口请求进行编辑可低于供应商折扣)

---
 LifePayment/LifePayment.Host/appsettings.json                    |    8 ++++----
 LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs |   31 ++++++++++++++++++++++++-------
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs    |   14 +++++++++++---
 3 files changed, 39 insertions(+), 14 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 6a80847..76526c7 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -1349,6 +1349,7 @@
     public async Task LifePaySuccessHandler(string orderNo, string outOrderNo)
     {
         var order = await _lifePayOrderRepository.Where(x => x.OrderNo == orderNo).FirstOrDefaultAsync();
+        _logger.LogInformation($"姝e湪澶勭悊璁㈠崟锛歿order?.Id}-{order?.PayStatus}");
         CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
 
         if (order.PayStatus != LifePayStatusEnum.鏈敮浠�)
@@ -1377,6 +1378,7 @@
                 default:
                     break;
             }
+            _logger.LogInformation("宸插悜渚涘簲鍟嗗彂璧疯鍗�");
 
             order.LifePayRefundStatus = LifePayRefundStatusEnum.鏃犻渶閫�娆�;
             order.LifePayOrderStatus = LifePayOrderStatusEnum.鍏呭�间腑;
@@ -1384,10 +1386,13 @@
             order.OutRequestNo = result.RequestNo.IsNullOrEmpty() ? null : result.RequestNo;
             order.ACOOLYOrderNo = result.ACOOLYOrderNo;
             order.ACOOLYStatus = ACOOLYStatusEnum.鍏呭�间腑;
+            await _lifePayOrderRepository.UpdateAsync(order);
+            _logger.LogInformation("鐢熸椿缂磋垂璁㈠崟鐘舵�侊細" + order.LifePayOrderStatus.ToString());
 
             /// 鍒涘缓鐢熸椿缂磋垂娑堣垂璁板綍
             await _lifePayOrderService.CreatLifePayConsumption(ACOOLYStatusEnum.鍏呭�间腑, order.OrderNo, order.ACOOLYOrderNo,
                                 order.PlatformDeductionAmount ?? 0, order.ChannelId, order.CreationTime, order.FinishTime);
+            _logger.LogInformation("宸叉彃鍏ユ秷璐硅褰�");
         }
         catch (Exception ex)
         {
@@ -1396,10 +1401,9 @@
             order.LifePayRefundStatus = LifePayRefundStatusEnum.寰呴��娆�;
             order.ACOOLYStatus = ACOOLYStatusEnum.鍏呭�煎け璐�;
             order.RefundApplyRemark = ex.Message;
+            await _lifePayOrderRepository.UpdateAsync(order);
+            _logger.LogError("鐢熸椿缂磋垂璁㈠崟鐘舵�侊細" + order.LifePayOrderStatus.ToString());
         }
-
-        _logger.LogError("鐢熸椿缂磋垂璁㈠崟鐘舵�侊細" + order.LifePayOrderStatus.ToString());
-        await _lifePayOrderRepository.UpdateAsync(order);
     }
 
     public async Task LifePayRefundsHandler(string orderNo, LifePayRefundStatusEnum refundStatus)
@@ -1791,6 +1795,9 @@
                 dto.PromoterId = promoter.Id;
             }
 
+            var rate = await _lifePayRateRepository.FirstOrDefaultAsync(it => it.RateType == LifePayRateTypeEnum.渚涘簲鍟嗘姌鎵d环);
+            CheckExtensions.IfTrueThrowUserFriendlyException(rate != null && input.ChannlesRate < rate.Rate, "娓犻亾鎶樻墸鏃犳硶浣庝簬渚涘簲鍟嗘姌鎵�");
+
             dto.ChannlesName = input.ChannlesName;
             dto.ChannlesNum = input.ChannlesNum;
             dto.ChannlesRate = input.ChannlesRate;
@@ -1800,6 +1807,7 @@
             dto.AgentType = input.AgentType;
             dto.AreaProvinceId = input.AreaProvinceId;
             dto.AreaCityId = input.AreaCityId;
+
             #region 璁板綍鏃ュ織
 
             await LifePayOrderHistory("娓犻亾绠$悊", "缂栬緫", input.Id.Value, TableType.LifePayChannles);
diff --git a/LifePayment/LifePayment.Host/appsettings.json b/LifePayment/LifePayment.Host/appsettings.json
index 735d874..bcbf82b 100644
--- a/LifePayment/LifePayment.Host/appsettings.json
+++ b/LifePayment/LifePayment.Host/appsettings.json
@@ -19,10 +19,10 @@
     "OssRoleRan": "acs:ram::1483797030072898:role/boleoss"
   },
   "ConnectionStrings": {
-    //"AbpIdentity": "Server=120.26.58.240; Database=Dev_LifePaymentIdentity; User=bole;Password=Bole1472589",
-    //"LifePaymentServices": "Server=120.26.58.240; Database=Dev_LifePayment; User=bole;Password=Bole1472589",
-    "LifePaymentServices": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Dev_LifePayment;Uid=bole;Pwd=Blcs20@%27;",
-    "AbpIdentity": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Dev_LifePaymentIdentity;Uid=bole;Pwd=Blcs20@%27;",
+    "AbpIdentity": "Server=120.26.58.240; Database=Dev_LifePaymentIdentity; User=bole;Password=Bole1472589",
+    "LifePaymentServices": "Server=120.26.58.240; Database=Dev_LifePayment; User=bole;Password=Bole1472589",
+    //"LifePaymentServices": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Dev_LifePayment;Uid=bole;Pwd=Blcs20@%27;",
+    //"AbpIdentity": "Server=rm-bp1mt744021h1s6dg4o.sqlserver.rds.aliyuncs.com,2333;Database=Dev_LifePaymentIdentity;Uid=bole;Pwd=Blcs20@%27;",
 
     "SyncAbpIdentity": "Server=120.26.58.240; Database=Dev_LifePaymentIdentity; User=bole;Password=Bole1472589",
     "SyncLifePaymentServices": "Server=120.26.58.240; Database=Dev_LifePayment; User=bole;Password=Bole1472589"
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
index d5bead3..de9e04b 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
@@ -11,6 +11,7 @@
 using Volo.Abp.AspNetCore.Mvc;
 using Volo.Abp.Caching;
 using Volo.Abp.Uow;
+using ZeroD.Util;
 
 namespace LifePayment.HttpApi
 {
@@ -52,19 +53,22 @@
         {
             try
             {
-                _logger.LogError($"鐢熸椿绠″寰俊鍏呭�煎洖璋冮�氱煡锛氳繘鍏ュ井淇″洖璋�:");
+                var req = input.ToJson();
+                _logger.LogInformation($"鐢熸椿绠″寰俊鍏呭�煎洖璋冮�氱煡锛氳繘鍏ュ井淇″洖璋�:" + req);
                 var data = _wxPayApi.AesGcmDecrypt(input.Resource.AssociatedData, input.Resource.Nonce, input.Resource.Ciphertext);
-                _logger.LogError($"鐢熸椿绠″寰俊鍏呭�煎洖璋冮�氱煡data锛�" + data);
+                _logger.LogInformation($"鐢熸椿绠″寰俊鍏呭�煎洖璋冮�氱煡data锛�" + data);
                 var wxPayNotice = JsonConvert.DeserializeObject<WxPayNotice>(data);
 
-                if (wxPayNotice.OutTradeNo.Contains("JF") )
+                if (wxPayNotice.OutTradeNo.Contains("JF"))
                 {
                     if (wxPayNotice.TradeState == LifePaymentConstant.WxPayStatus.鏀粯鎴愬姛)
                     {
                         var key = $"WxRechargeNotify_{wxPayNotice.OutTradeNo}";
                         if (string.IsNullOrWhiteSpace(distributedCache.Get(key)))
                         {
+                            _logger.LogInformation("姝e湪澶勭悊鍥炶皟");
                             await _lifePayService.LifePaySuccessHandler(wxPayNotice.OutTradeNo, wxPayNotice.TransactionId);
+                            _logger.LogInformation("宸插鐞嗗洖璋�");
 
                             // 鎻掑叆鏀舵敮娴佹按
                             await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
@@ -75,13 +79,26 @@
                                 ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses,
                                 Amount = wxPayNotice.Amount.Total
                             });
+                            _logger.LogInformation("宸叉彃鍏ユ敹鏀祦姘�");
 
                             distributedCache.Set(key, data, new DistributedCacheEntryOptions
                             {
                                 AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10)
                             });
                         }
+                        else
+                        {
+                            _logger.LogInformation("宸茶繃婊ら噸澶嶈姹�");
+                        }
                     }
+                    else
+                    {
+                        _logger.LogInformation("浜ゆ槗鐘舵�佷笉绗﹀悎瑙勫垯");
+                    }
+                }
+                else
+                {
+                    _logger.LogInformation("璁㈠崟鍙蜂笉绗﹀悎瑙勫垯");
                 }
             }
             catch (Exception ex)
@@ -113,12 +130,12 @@
             {
                 _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡锛氳繘鍏ュ井淇″洖璋�");
                 var data = _wxPayApi.AesGcmDecrypt(input.Resource.AssociatedData, input.Resource.Nonce, input.Resource.Ciphertext);
-                _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡data锛�"+ data);
+                _logger.LogError($"寰俊閫�娆惧洖璋冮�氱煡data锛�" + data);
                 var wxPayNotice = JsonConvert.DeserializeObject<WxPayDomesticRefundsNotice>(data);
 
                 if (wxPayNotice.OutTradeNo.Contains("JF"))
                 {
-                   
+
                     switch (wxPayNotice.RefundStatus)
                     {
                         case LifePaymentConstant.WxPayRefundStatus.閫�娆炬垚鍔�:
@@ -139,13 +156,13 @@
                         case LifePaymentConstant.WxPayRefundStatus.閫�娆惧紓甯�:
                             await _lifePayService.LifePayRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑);
                             break;
-                        default : await _lifePayService.LifePayRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑);break;
+                        default: await _lifePayService.LifePayRefundsHandler(wxPayNotice.OutTradeNo, LifePayRefundStatusEnum.閫�娆句腑); break;
                     }
                 }
             }
             catch (Exception ex)
             {
-                
+
                 return new WxRechargeNotifyResult
                 {
                     Code = "FAIL",

--
Gitblit v1.9.1