Procházet zdrojové kódy

修改推送状态

tangjiang před 10 měsíci
rodič
revize
3ca8546607
1 změnil soubory, kde provedl 8 přidání a 2 odebrání
  1. 8 2
      src/Hotline/Push/FWMessage/PushDomainService.cs

+ 8 - 2
src/Hotline/Push/FWMessage/PushDomainService.cs

@@ -108,7 +108,7 @@ public class PushDomainService : IPushDomainService, IScopeDependency
         }
         #endregion
         var message = _mapper.Map<Message>(messageDto);
-        var id = await _messageRepository.AddAsync(message);//写入本地数据库
+        var id = await _messageRepository.AddAsync(message, cancellation);//写入本地数据库
 
         PushMessageDto pushMessage = new()
         {
@@ -120,7 +120,13 @@ public class PushDomainService : IPushDomainService, IScopeDependency
             TelNumber = message.TelNumber
         };
 
-        await ExecuteAsync<PushMessageDto, SendSmsReponse>(_sendSmsConfiguration.Value.Url, pushMessage, cancellationToken: cancellation);
+        var result = await ExecuteAsync<PushMessageDto, SendSmsReponse>(_sendSmsConfiguration.Value.Url, pushMessage, cancellationToken: cancellation);
+        if (result != null && result.code == 0)
+        {
+            message.Status = EPushStatus.Success;
+            message.SendState = ESendState.Sending;
+            await _messageRepository.UpdateAsync(message, cancellation);
+        }
     }
 
     /// <summary>