From c87d61d03b48a6f55c0a0819b9be522f77e3c9a0 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期一, 01 十二月 2025 14:48:40 +0800
Subject: [PATCH] feat:开发

---
 ApiTools.Application/WxUtils/Commands/WxmpSubscribMessageCommandHandler.cs |   27 +++++++++++++++++----------
 1 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/ApiTools.Application/WxUtils/Commands/WxmpSubscribMessageCommandHandler.cs b/ApiTools.Application/WxUtils/Commands/WxmpSubscribMessageCommandHandler.cs
index 3e600b2..bfdf10c 100644
--- a/ApiTools.Application/WxUtils/Commands/WxmpSubscribMessageCommandHandler.cs
+++ b/ApiTools.Application/WxUtils/Commands/WxmpSubscribMessageCommandHandler.cs
@@ -1,5 +1,7 @@
 锘縰sing Aop.Api.Domain;
 using ApiTools.Core;
+using Furion;
+using Furion.HttpRemote;
 using log4net.Core;
 using MediatR;
 using Microsoft.AspNetCore.Http;
@@ -15,14 +17,14 @@
     public class WxmpSubscribMessageCommandHandler(
             ILogger<WxmpSubscribMessageCommandHandler> logger,
             WxmpUtils utils,
-            IHttpContextAccessor httpContextAccessor
+            IHttpRemoteService httpRemoteService
         ) :
         IRequestHandler<SendWxmpSubscribMessageCommand, Guid>,
         IRequestHandler<WxmpSubscribMessageNotifyCommand, bool>
     {
         private readonly ILogger<WxmpSubscribMessageCommandHandler> logger = logger;
         private readonly WxmpUtils utils = utils;
-        private readonly IHttpContextAccessor httpContextAccessor = httpContextAccessor;
+        private readonly IHttpRemoteService httpRemoteService = httpRemoteService;
 
         /// <summary>
         /// 寰俊灏忕▼搴忓彂閫佽闃呮秷鎭�
@@ -51,15 +53,20 @@
         /// <returns></returns>
         public async Task<bool> Handle(WxmpSubscribMessageNotifyCommand request, CancellationToken cancellationToken)
         {
-            var req = httpContextAccessor.HttpContext.Request;
-            logger.LogInformation($"寰俊灏忕▼搴忚闃呮秷鎭�氱煡query锛歿req.QueryString.Value}");
+            var env = App.GetConfig<string>("Environment");
+            if (env == "Product")
+            {
+                try
+                {
+                    var json = request.ToJson();
+                    await httpRemoteService.PostAsStringAsync("http://118.178.252.28:8780/api/common/wxmp/wxmpSubscribMessageNotify",
+                        builder => builder.SetJsonContent(json));
+                }
+                catch
+                {
 
-            req.EnableBuffering();
-            req.Body.Position = 0;
-            using var reader = new StreamReader(req.Body, Encoding.UTF8, leaveOpen: true);
-            var body = await reader.ReadToEndAsync();
-            logger.LogInformation($"寰俊灏忕▼搴忚闃呮秷鎭�氱煡body锛歿body}");
-            req.Body.Position = 0;
+                }
+            }
             return true;
         }
     }

--
Gitblit v1.9.1