|
@@ -2,6 +2,7 @@
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.Push.FWMessage;
|
|
|
using Hotline.Push.Notifies;
|
|
|
+using Hotline.Settings;
|
|
|
using Hotline.Share.Dtos.Push;
|
|
|
using Hotline.Share.Enums.Push;
|
|
|
using Hotline.Share.Mq;
|
|
@@ -14,16 +15,22 @@ public class OrderVisitSmsHandler : INotificationHandler<ReceiveMessageNotify>
|
|
|
{
|
|
|
private readonly IOrderVisitDomainService _orderVisitDomainService;
|
|
|
private readonly IRepository<Message> _messageRepository;
|
|
|
+ private readonly ISystemLogRepository _logRepository;
|
|
|
|
|
|
- public OrderVisitSmsHandler(IOrderVisitDomainService orderVisitDomainService, IRepository<Message> messageRepository)
|
|
|
+ public OrderVisitSmsHandler(IOrderVisitDomainService orderVisitDomainService, IRepository<Message> messageRepository, ISystemLogRepository logRepository)
|
|
|
{
|
|
|
_orderVisitDomainService = orderVisitDomainService;
|
|
|
_messageRepository = messageRepository;
|
|
|
+ _logRepository = logRepository;
|
|
|
}
|
|
|
|
|
|
public async Task Handle(ReceiveMessageNotify notification, CancellationToken cancellationToken)
|
|
|
{
|
|
|
- if (notification.NotifyDto.Type != "2") return;
|
|
|
+ if (notification.NotifyDto.Type != "2")
|
|
|
+ {
|
|
|
+ _logRepository.Add("短信回访-不处理", notification, "Type=2才处理,现在Type:" + notification.NotifyDto.Type, "OrderVisitSmsHandler", 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
var msg = await _messageRepository
|
|
|
.Queryable()
|
|
@@ -31,8 +38,12 @@ public class OrderVisitSmsHandler : INotificationHandler<ReceiveMessageNotify>
|
|
|
.Where(m => m.PushBusiness == EPushBusiness.VisitSms || m.PushBusiness == EPushBusiness.SearchSms)
|
|
|
.Where(m => m.SendState == ESendState.Success)
|
|
|
.OrderByDescending(m => m.CreationTime)
|
|
|
- .FirstAsync();
|
|
|
- if (msg.SendTime!.Value.AddDays(2) < DateTime.Now) return;
|
|
|
+ .FirstAsync(cancellationToken);
|
|
|
+ if (msg.SendTime!.Value.AddDays(2) < DateTime.Now)
|
|
|
+ {
|
|
|
+ _logRepository.Add("短信回访-不处理", notification, "msg.SendTime 已经超过2天, 不处理", "OrderVisitSmsHandler", 0);
|
|
|
+ return;
|
|
|
+ }
|
|
|
await _orderVisitDomainService.UpdateSmsReplyAsync(notification.NotifyDto);
|
|
|
}
|
|
|
}
|