Browse Source

feat(notifications): Add notification push log recording

pull/1370/head
colin 5 months ago
parent
commit
8346fc1076
  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.Lifetime, map => map.Ignore())
.ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) => .ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) =>
{ {
var dataType = Type.GetType(src.NotificationTypeName); if (src != null)
var data = Activator.CreateInstance(dataType);
if (data is NotificationData notificationData)
{ {
notificationData.ExtraProperties = src.ExtraProperties; var dataType = Type.GetType(src.NotificationTypeName);
return notificationData; var data = Activator.CreateInstance(dataType);
if (data is NotificationData notificationData)
{
notificationData.ExtraProperties = src.ExtraProperties;
return notificationData;
}
} }
return new 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); 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, webhook: webhook,
callbackUrl: callbackUrl, callbackUrl: callbackUrl,
cancellationToken: cancellationToken); 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"); Logger.LogDebug($"Found a singalr group, begin senging notifications");
await singalRGroup.SendAsync(_options.MethodName, notification, cancellationToken); await singalRGroup.SendAsync(_options.MethodName, notification, cancellationToken);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
} }
catch (Exception ex) 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.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
@ -30,5 +31,7 @@ public class SmsNotificationPublishProvider : NotificationPublishProvider
return; return;
} }
await Sender.SendAsync(notification, sendToPhones.JoinAsString(",")); 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); 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; message.ToParty = toParty;
await WeChatWorkMessageSender.SendAsync(message, cancellationToken); 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) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
Configure<AbpNotificationsWebhookWeChatWorkOptions>(options =>
{
options.UseMarkdownV2 = true;
});
Configure<AbpNotificationsWebhookOptions>(options => Configure<AbpNotificationsWebhookOptions>(options =>
{ {
options.Contributors.Add(new WeChatWorkWebhookNotificationContributor()); 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, uids: uids,
url: url, url: url,
cancellationToken: cancellationToken); cancellationToken: cancellationToken);
Logger.LogDebug("The notification: {0} with provider: {1} has successfully published!", notification.Name, Name);
} }
} }

Loading…
Cancel
Save