Quellcode durchsuchen

修改短信回访为空报错

tangjiang vor 1 Woche
Ursprung
Commit
89b7c7a65f

+ 7 - 4
src/Hotline.Application/OrderApp/Handlers/OrderHandler/OrderVisitSmsHandler.cs

@@ -39,12 +39,15 @@ public class OrderVisitSmsHandler : INotificationHandler<ReceiveMessageNotify>
             .Where(m => m.SendState == ESendState.Success)
             .OrderByDescending(m => m.CreationTime)
             .FirstAsync(cancellationToken);
-        if (msg.SendTime!.Value.AddDays(2) < DateTime.Now)
+        if (msg != null)
         {
-            _logRepository.Add("短信回访-不处理", notification, "msg.SendTime 已经超过2天, 不处理", "OrderVisitSmsHandler", 0);
-            return;
+            if (msg.SendTime!.Value.AddDays(2) < DateTime.Now)
+            {
+                _logRepository.Add("短信回访-不处理", notification, "msg.SendTime 已经超过2天, 不处理", "OrderVisitSmsHandler", 0);
+                return;
+            }
+            await _orderVisitDomainService.UpdateSmsReplyAsync(notification.NotifyDto);
         }
-        await _orderVisitDomainService.UpdateSmsReplyAsync(notification.NotifyDto);
     }
 }