| | |
| | | using ApiTools.Core; |
| | | using Furion; |
| | | using Furion.DatabaseAccessor; |
| | | using Furion.HttpRemote; |
| | | using MediatR; |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.EntityFrameworkCore; |
| | |
| | | public class SmsAliyunNotifyCommandHandler( |
| | | IRepository<SmsSetting> repSmsSetting, |
| | | IRepository<SmsLog> repSmsLog, |
| | | ApiTools.Core.SmsUtils smsUtils |
| | | ApiTools.Core.SmsUtils smsUtils, |
| | | IHttpRemoteService httpRemoteService |
| | | ) |
| | | : IRequestHandler<SmsAliyunNotifyCommand, SmsAliyunNotifyCommandResult> |
| | | { |
| | | private readonly IRepository<SmsSetting> repSmsSetting = repSmsSetting; |
| | | private readonly IRepository<SmsLog> repSmsLog = repSmsLog; |
| | | private readonly Core.SmsUtils smsUtils = smsUtils; |
| | | private readonly IHttpRemoteService httpRemoteService = httpRemoteService; |
| | | |
| | | /// <summary> |
| | | /// 阿里云短信平台回传通知 |
| | |
| | | /// <returns></returns> |
| | | public async Task<SmsAliyunNotifyCommandResult> Handle(SmsAliyunNotifyCommand request, CancellationToken cancellationToken) |
| | | { |
| | | if (App.GetConfig<string>("Environment") == "Product") |
| | | { |
| | | try |
| | | { |
| | | await httpRemoteService.PostAsStringAsync("http://118.178.252.28:8780/api/common/sms/smsAliyunNotify", |
| | | builder => builder.SetJsonContent(request)); |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | } |
| | | var templateCodes = await EnumUtils.GetModel<EnumSmsTemplateCode>(); |
| | | var msgIds = request.DistinctSelect(it => it.BizId.ToString()); |
| | | var entities = await repSmsLog.AsQueryable() |