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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with
29 additions and
6 deletions
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Application/LINGYUN/Abp/Notifications/AbpNotificationsApplicationAutoMapperProfile.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Emailing/LINGYUN/Abp/Notifications/Emailing/EmailingNotificationPublishProvider.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.PushPlus/LINGYUN/Abp/Notifications/PushPlus/PushPlusNotificationPublishProvider.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.SignalR/LINGYUN/Abp/Notifications/SignalR/SignalRNotificationPublishProvider.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Sms/LINGYUN/Abp/Notifications/Sms/SmsNotificationPublishProvider.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WeChat.MiniProgram/LINGYUN/Abp/Notifications/WeChat/MiniProgram/WeChatMiniProgramNotificationPublishProvider.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WeChat.Work/LINGYUN/Abp/Notifications/WeChat/Work/WeChatWorkNotificationPublishProvider.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.Webhook.WeChat.Work/LINGYUN/Abp/Notifications/Webhook/WeChat/Work/AbpNotificationsWebhookWeChatWorkModule.cs
-
aspnet-core/modules/realtime-notifications/LINGYUN.Abp.Notifications.WxPusher/LINGYUN/Abp/Notifications/WxPusher/WxPusherNotificationPublishProvider.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(); |
|
|
|
})); |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -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()); |
|
|
|
|
|
|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|
|