Browse Source

Merge pull request #1370 from colinin/notifier-push-log

feat(notifications): Add notification push log recording
pull/1377/head
yx lin 3 months ago
committed by GitHub
parent
commit
73bbeb4292
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 13
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationAutoMapperProfile.cs
  2. 2
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs
  3. 2
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.PushPlus/LINGYUN/Abp/Notifications/PushPlus/PushPlusNotificationPublishProvider.cs
  4. 2
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs
  5. 5
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Sms/LINGYUN/Abp/Notifications/Sms/SmsNotificationPublishProvider.cs
  6. 2
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WeChat.MiniProgram/LINGYUN/Abp/Notifications/WeChat/MiniProgram/WeChatMiniProgramNotificationPublishProvider.cs
  7. 2
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WeChat.Work/LINGYUN/Abp/Notifications/WeChat/Work/WeChatWorkNotificationPublishProvider.cs
  8. 5
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Webhook.WeChat.Work/LINGYUN/Abp/Notifications/Webhook/WeChat/Work/AbpNotificationsWebhookWeChatWorkModule.cs
  9. 2
      aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher/LINGYUN/Abp/Notifications/WxPusher/WxPusherNotificationPublishProvider.cs

13
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationAutoMapperProfile.cs

@ -12,12 +12,15 @@ public class AbpNotificationsApplicationAutoMapperProfile : Profile
.ForMember(dto => dto.Lifetime, map => map.Ignore())
.ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) =>
{
var dataType = Type.GetType(src.NotificationTypeName);
var data = Activator.CreateInstance(dataType);
if (data is NotificationData notificationData)
if (src != null)
{
notificationData.ExtraProperties = src.ExtraProperties;
return notificationData;
var dataType = Type.GetType(src.NotificationTypeName);
var data = Activator.CreateInstance(dataType);
if (data is NotificationData notificationData)
{
notificationData.ExtraProperties = src.ExtraProperties;
return notificationData;
}
}
return new NotificationData();
}));

2
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs

@ -59,5 +59,7 @@ public class EmailingNotificationPublishProvider : NotificationPublishProvider
}
await EmailSender.SendAsync(emailAddress, notificationData.Title, notificationData.Message);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
}
}

2
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.PushPlus/LINGYUN/Abp/Notifications/PushPlus/PushPlusNotificationPublishProvider.cs

@ -64,5 +64,7 @@ public class PushPlusNotificationPublishProvider : NotificationPublishProvider
webhook: webhook,
callbackUrl: callbackUrl,
cancellationToken: cancellationToken);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
}
}

2
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs

@ -40,6 +40,8 @@ public class SignalRNotificationPublishProvider : NotificationPublishProvider
// 租户通知群发
Logger.LogDebug($"Found a singalr group, begin senging notifications");
await singalRGroup.SendAsync(_options.MethodName, notification, cancellationToken);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
}
catch (Exception ex)
{

5
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Sms/LINGYUN/Abp/Notifications/Sms/SmsNotificationPublishProvider.cs

@ -1,4 +1,5 @@
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@ -30,5 +31,7 @@ public class SmsNotificationPublishProvider : NotificationPublishProvider
return;
}
await Sender.SendAsync(notification, sendToPhones.JoinAsString(","));
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
}
}

2
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WeChat.MiniProgram/LINGYUN/Abp/Notifications/WeChat/MiniProgram/WeChatMiniProgramNotificationPublishProvider.cs

@ -93,6 +93,8 @@ public class WeChatMiniProgramNotificationPublishProvider : NotificationPublishP
// 发送小程序订阅消息
await SubscribeMessager.SendAsync(weChatWeAppNotificationData, cancellationToken);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
}
}

2
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WeChat.Work/LINGYUN/Abp/Notifications/WeChat/Work/WeChatWorkNotificationPublishProvider.cs

@ -117,5 +117,7 @@ public class WeChatWorkNotificationPublishProvider : NotificationPublishProvider
message.ToParty = toParty;
await WeChatWorkMessageSender.SendAsync(message, cancellationToken);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
}
}

5
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Webhook.WeChat.Work/LINGYUN/Abp/Notifications/Webhook/WeChat/Work/AbpNotificationsWebhookWeChatWorkModule.cs

@ -10,6 +10,11 @@ public class AbpNotificationsWebhookWeChatWorkModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpNotificationsWebhookWeChatWorkOptions>(options =>
{
options.UseMarkdownV2 = true;
});
Configure<AbpNotificationsWebhookOptions>(options =>
{
options.Contributors.Add(new WeChatWorkWebhookNotificationContributor());

2
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher/LINGYUN/Abp/Notifications/WxPusher/WxPusherNotificationPublishProvider.cs

@ -64,5 +64,7 @@ public class WxPusherNotificationPublishProvider : NotificationPublishProvider
uids: uids,
url: url,
cancellationToken: cancellationToken);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
}
}

Loading…
Cancel
Save