sunpengfei
2025-10-09 eeb1019e42abc3fc0e4b10b181b46c02b6e58843
ApiTools.Application/SmsUtils/Commands/SmsChengLiYeNotifyCommandHandler.cs
@@ -1,5 +1,6 @@
using Baidu.Aip.BodyAnalysis;
using ApiTools.Core;
using ApiTools.Core;
using Baidu.Aip.BodyAnalysis;
using Furion;
using Furion.DatabaseAccessor;
using Furion.HttpRemote;
using MediatR;
@@ -22,7 +23,8 @@
            IHttpContextAccessor httpContextAccessor,
            IRepository<SmsSetting> repSmsSetting,
            IRepository<SmsLog> repSmsLog,
            ApiTools.Core.SmsUtils smsUtils
            ApiTools.Core.SmsUtils smsUtils,
            IHttpRemoteService httpRemoteService
        ) :
        IRequestHandler<SmsChengLiYeNotifyCommand, bool>
    {
@@ -30,6 +32,7 @@
        private readonly IRepository<SmsSetting> repSmsSetting = repSmsSetting;
        private readonly IRepository<SmsLog> repSmsLog = repSmsLog;
        private readonly ApiTools.Core.SmsUtils smsUtils = smsUtils;
        private readonly IHttpRemoteService httpRemoteService = httpRemoteService;
        /// <summary>
        /// 诚立业短信平台回传通知
@@ -39,6 +42,18 @@
        /// <returns></returns>
        public async Task<bool> Handle(SmsChengLiYeNotifyCommand request, CancellationToken cancellationToken)
        {
            if (App.GetConfig<string>("Environment") == "Product")
            {
                try
                {
                    await httpRemoteService.PostAsStringAsync("http://118.178.252.28:8780/api/common/sms/smsChengLiYeNotify",
                        builder => builder.SetJsonContent(request));
                }
                catch
                {
                }
            }
            if (request.MsgReports.IsNotNull())
            {
                var templateCodes = await EnumUtils.GetModel<EnumSmsTemplateCode>();