diff --git a/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj b/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj index bba35b34b..7443bfa12 100644 --- a/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj +++ b/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN.Abp.MessageService.HttpApi.Host.csproj @@ -6,6 +6,8 @@ + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs b/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs index 917a61050..d7f763c9f 100644 --- a/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs +++ b/aspnet-core/LINGYUN.Abp.MessageService.HttpApi.Host/LINGYUN/Abp/MessageService/AbpMessageServiceHttpApiHostModule.cs @@ -1,20 +1,19 @@ -using IdentityModel; +using DotNetCore.CAP; +using IdentityModel; +using LINGYUN.Abp.EventBus.CAP; using LINGYUN.Abp.IM.SignalR; using LINGYUN.Abp.MessageService.EntityFrameworkCore; using LINGYUN.Abp.MessageService.MultiTenancy; using LINGYUN.Abp.Notifications.SignalR; -using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Options; using Microsoft.OpenApi.Models; using StackExchange.Redis; using System; -using System.Threading.Tasks; using Volo.Abp; using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.MultiTenancy; @@ -41,10 +40,26 @@ namespace LINGYUN.Abp.MessageService typeof(AbpAspNetCoreAuthenticationJwtBearerModule), typeof(AbpIMSignalRModule), typeof(AbpNotificationsSignalRModule), + typeof(AbpCAPEventBusModule), typeof(AbpAutofacModule) )] public class AbpMessageServiceHttpApiHostModule : AbpModule { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + var configuration = context.Services.GetConfiguration(); + + PreConfigure(options => + { + options + .UseMySql(configuration.GetConnectionString("Default")) + .UseRabbitMQ(rabbitMQOptions => + { + configuration.GetSection("CAP:RabbitMQ").Bind(rabbitMQOptions); + }); + }); + } + public override void ConfigureServices(ServiceConfigurationContext context) { var hostingEnvironment = context.Services.GetHostingEnvironment(); diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs index 9e4856d84..75b05f35e 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessageHub.cs @@ -5,7 +5,6 @@ using Microsoft.AspNetCore.SignalR; using Microsoft.Extensions.Logging; using System; using System.Threading.Tasks; -using Volo.Abp.AspNetCore.SignalR; namespace LINGYUN.Abp.IM.SignalR.Hubs { @@ -30,46 +29,58 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs // 持久化 await _messageStore.StoreMessageAsync(chatMessage); - if (!chatMessage.GroupId.IsNullOrWhiteSpace()) + try { - try + if (!chatMessage.GroupId.IsNullOrWhiteSpace()) { - var signalRClient = Clients.Group(chatMessage.GroupId); - if (signalRClient == null) - { - Logger.LogDebug("Can not get group " + chatMessage.GroupId + " from SignalR hub!"); - return; - } - - await signalRClient.SendAsync("getChatMessage", chatMessage); + await SendMessageToGroupAsync(chatMessage); } - catch (Exception ex) + else { - Logger.LogWarning("Could not send message to group: {0}", chatMessage.GroupId); - Logger.LogWarning("Send group message error: {0}", ex.Message); + await SendMessageToUserAsync(chatMessage); } } - else + catch (Exception ex) + { + Logger.LogWarning("Could not send message, group: {0}, formUser: {1}, toUser: {2}", + chatMessage.GroupId, chatMessage.FormUserName, + chatMessage.ToUserId.HasValue ? chatMessage.ToUserId.ToString() : "None"); + Logger.LogWarning("Send group message error: {0}", ex.Message); + } + } + + protected virtual async Task SendMessageToGroupAsync(ChatMessage chatMessage) + { + var signalRClient = Clients.Group(chatMessage.GroupId); + if (signalRClient == null) + { + Logger.LogDebug("Can not get group " + chatMessage.GroupId + " from SignalR hub!"); + return; + } + + await signalRClient.SendAsync("getChatMessage", chatMessage); + } + + protected virtual async Task SendMessageToUserAsync(ChatMessage chatMessage) + { + var onlineClientContext = new OnlineClientContext(chatMessage.TenantId, chatMessage.ToUserId.GetValueOrDefault()); + var onlineClients = OnlineClientManager.GetAllByContext(onlineClientContext); + foreach (var onlineClient in onlineClients) { - var onlineClientContext = new OnlineClientContext(chatMessage.TenantId, chatMessage.ToUserId.GetValueOrDefault()); - var onlineClients = OnlineClientManager.GetAllByContext(onlineClientContext); - foreach (var onlineClient in onlineClients) + try { - try - { - var signalRClient = Clients.Client(onlineClient.ConnectionId); - if (signalRClient == null) - { - Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " with connectionId " + onlineClient.ConnectionId + " from SignalR hub!"); - continue; - } - await signalRClient.SendAsync("getChatMessage", chatMessage); - } - catch (Exception ex) + var signalRClient = Clients.Client(onlineClient.ConnectionId); + if (signalRClient == null) { - Logger.LogWarning("Could not send message to user: {0}", chatMessage.ToUserId); - Logger.LogWarning("Send to user message error: {0}", ex.Message); + Logger.LogDebug("Can not get user " + onlineClientContext.UserId + " with connectionId " + onlineClient.ConnectionId + " from SignalR hub!"); + continue; } + await signalRClient.SendAsync("getChatMessage", chatMessage); + } + catch (Exception ex) + { + Logger.LogWarning("Could not send message to user: {0}", chatMessage.ToUserId); + Logger.LogWarning("Send to user message error: {0}", ex.Message); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/AbpMessageServiceDomainSharedModule.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/AbpMessageServiceDomainSharedModule.cs new file mode 100644 index 000000000..d5aac9362 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/LINGYUN/Abp/MessageService/AbpMessageServiceDomainSharedModule.cs @@ -0,0 +1,18 @@ +using LINGYUN.Abp.MessageService.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.MessageService +{ + [DependsOn(typeof(AbpLocalizationModule))] + public class AbpMessageServiceDomainSharedModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.Resources.Add("en"); + }); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/Users/Notifications/UserNotificationNames.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/Users/Notifications/UserNotificationNames.cs new file mode 100644 index 000000000..dc8063377 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain.Shared/Volo/Abp/Users/Notifications/UserNotificationNames.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.Users.Notifications +{ + public class UserNotificationNames + { + public const string GroupName = "Volo.Abp.Users"; + + public const string WelcomeToApplication = GroupName + ".WelcomeToApplication"; + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs index b48c045fd..60dfe789c 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/AbpMessageServiceDomainModule.cs @@ -1,10 +1,16 @@ -using LINGYUN.Abp.MessageService.Mapper; +using LINGYUN.Abp.MessageService.Localization; +using LINGYUN.Abp.MessageService.Mapper; using Volo.Abp.AutoMapper; +using Volo.Abp.Localization; +using Volo.Abp.Localization.ExceptionHandling; using Volo.Abp.Modularity; +using Volo.Abp.VirtualFileSystem; namespace LINGYUN.Abp.MessageService { - [DependsOn(typeof(AbpAutoMapperModule))] + [DependsOn( + typeof(AbpAutoMapperModule), + typeof(AbpMessageServiceDomainSharedModule))] public class AbpMessageServiceDomainModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) @@ -13,6 +19,24 @@ namespace LINGYUN.Abp.MessageService { options.AddProfile(validate: true); }); + + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Get() + .AddVirtualJson("/LINGYUN/Abp/MessageService/Localization/Resources"); + }); + + Configure(options => + { + options.MapCodeNamespace("Messages:Group", typeof(MessageServiceResource)); + options.MapCodeNamespace("Messages:User", typeof(MessageServiceResource)); + }); } } } diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Distributed/UserCreateEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Distributed/UserCreateEventHandler.cs new file mode 100644 index 000000000..2b7bbcdf4 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Distributed/UserCreateEventHandler.cs @@ -0,0 +1,31 @@ +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.Domain.Entities.Events.Distributed; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.EventBus.Local; +using Volo.Abp.Users; + +namespace LINGYUN.Abp.MessageService.EventBus.Distributed +{ + public class UserCreateEventHandler : IDistributedEventHandler>, ITransientDependency + { + private readonly ILocalEventBus _localEventBus; + public UserCreateEventHandler( + ILocalEventBus localEventBus) + { + _localEventBus = localEventBus; + } + /// + /// 接收添加用户事件,发布本地事件 + /// + /// + /// + public async Task HandleEventAsync(EntityCreatedEto eventData) + { + var localUserCreateEventData = new EntityCreatedEventData(eventData.Entity); + + await _localEventBus.PublishAsync(localUserCreateEventData); + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/UserCreateEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs similarity index 79% rename from aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/UserCreateEventHandler.cs rename to aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs index 30e0cead3..ea2773bf4 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/UserCreateEventHandler.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateJoinIMEventHandler.cs @@ -1,19 +1,20 @@ using LINGYUN.Abp.MessageService.Messages; using System.Threading.Tasks; -using Volo.Abp.Domain.Entities.Events.Distributed; -using Volo.Abp.EventBus.Distributed; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; using Volo.Abp.MultiTenancy; using Volo.Abp.Uow; using Volo.Abp.Users; -namespace LINGYUN.Abp.MessageService.EventBus +namespace LINGYUN.Abp.MessageService.EventBus.Distributed { - public class UserCreateEventHandler : IDistributedEventHandler> + public class UserCreateJoinIMEventHandler : ILocalEventHandler>, ITransientDependency { private readonly ICurrentTenant _currentTenant; private readonly IUnitOfWorkManager _unitOfWorkManager; private readonly IUserChatSettingRepository _userChatSettingRepository; - public UserCreateEventHandler( + public UserCreateJoinIMEventHandler( ICurrentTenant currentTenant, IUnitOfWorkManager unitOfWorkManager, IUserChatSettingRepository userChatSettingRepository) @@ -27,7 +28,7 @@ namespace LINGYUN.Abp.MessageService.EventBus /// /// /// - public async Task HandleEventAsync(EntityCreatedEto eventData) + public async Task HandleEventAsync(EntityCreatedEventData eventData) { using (var unitOfWork = _unitOfWorkManager.Begin()) { diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs new file mode 100644 index 000000000..6bea621c6 --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/EventBus/Local/UserCreateSendWelcomeEventHandler.cs @@ -0,0 +1,116 @@ +using LINGYUN.Abp.MessageService.Localization; +using LINGYUN.Abp.Notifications; +using Microsoft.Extensions.Localization; +using System; +using System.Globalization; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; +using Volo.Abp.Localization; +using Volo.Abp.Settings; +using Volo.Abp.Users; +using Volo.Abp.Users.Notifications; + +namespace LINGYUN.Abp.MessageService.EventBus +{ + public class UserCreateSendWelcomeEventHandler : ILocalEventHandler>, ITransientDependency + { + private readonly ISettingProvider _settingProvider; + private readonly IStringLocalizer _stringLocalizer; + private readonly INotificationStore _notificationStore; + private readonly INotificationDispatcher _notificationDispatcher; + + // 需要模拟用户令牌 + // 是否有必要 + // private readonly ICurrentPrincipalAccessor _currentPrincipalAccessor; + public UserCreateSendWelcomeEventHandler( + ISettingProvider settingProvider, + INotificationStore notificationStore, + INotificationDispatcher notificationDispatcher, + IStringLocalizer stringLocalizer + //ICurrentPrincipalAccessor currentPrincipalAccessor + ) + { + _settingProvider = settingProvider; + _stringLocalizer = stringLocalizer; + _notificationStore = notificationStore; + _notificationDispatcher = notificationDispatcher; + + //_currentPrincipalAccessor = currentPrincipalAccessor; + } + + public async Task HandleEventAsync(EntityCreatedEventData eventData) + { + // 获取默认语言 + var userDefaultCultureName = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); + if (!userDefaultCultureName.IsNullOrWhiteSpace()) + { + CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(userDefaultCultureName); + // CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(userDefaultCultureName); + } + // 订阅用户欢迎消息 + await _notificationStore.InsertUserSubscriptionAsync(eventData.Entity.TenantId, + eventData.Entity.Id, UserNotificationNames.WelcomeToApplication); + + var userWelcomeNotifiction = new NotificationInfo + { + CreationTime = DateTime.Now, + Name = UserNotificationNames.WelcomeToApplication, + NotificationSeverity = NotificationSeverity.Info, + NotificationType = NotificationType.System, + TenantId = eventData.Entity.TenantId + }; + userWelcomeNotifiction.Data.Properties["message"] = L("WelcomeToApplicationFormUser", eventData.Entity.UserName); + + await _notificationDispatcher.DispatcheAsync(userWelcomeNotifiction); + } + + //public async Task HandleEventAsync(EntityCreatedEventData eventData) + //{ + // // 模拟用户令牌 + // var mockUserPrincipal = new ClaimsPrincipal(); + // var mockUserIdentity = new ClaimsIdentity(); + // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.UserId, eventData.Entity.Id.ToString())); + // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.UserName, eventData.Entity.UserName)); + // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.Email, eventData.Entity.Email)); + // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.PhoneNumber, eventData.Entity.PhoneNumber)); + // if (eventData.Entity.TenantId.HasValue) + // { + // mockUserIdentity.AddClaim(new Claim(AbpClaimTypes.TenantId, eventData.Entity.TenantId.ToString())); + // } + + // mockUserPrincipal.AddIdentity(mockUserIdentity); + // using (_currentPrincipalAccessor.Change(mockUserPrincipal)) + // { + // // 获取默认语言 + // // TODO: 是否采用系统默认语言而不是用户默认语言? + // var userDefaultCultureName = await _settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); + // if (!userDefaultCultureName.IsNullOrWhiteSpace()) + // { + // CultureInfo.CurrentUICulture = CultureInfo.GetCultureInfo(userDefaultCultureName); + // } + // // 订阅用户欢迎消息 + // await _notificationStore.InsertUserSubscriptionAsync(eventData.Entity.TenantId, + // eventData.Entity.Id, UserNotificationNames.WelcomeToApplication); + + // var userWelcomeNotifiction = new NotificationInfo + // { + // CreationTime = DateTime.Now, + // Name = UserNotificationNames.WelcomeToApplication, + // NotificationSeverity = NotificationSeverity.Info, + // NotificationType = NotificationType.System, + // TenantId = eventData.Entity.TenantId + // }; + // userWelcomeNotifiction.Data.Properties["message"] = L("WelcomeToApplicationFormUser", eventData.Entity.UserName); + + // await _notificationDispatcher.DispatcheAsync(userWelcomeNotifiction); + // } + //} + + protected string L(string name, params object[] args) + { + return _stringLocalizer[name, args]?.Value; + } + } +} diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json index 948b35c47..c39859059 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/en.json @@ -6,6 +6,7 @@ "Messages:Group:1003": "The administrator has banned you from speaking!", "Messages:User:1001": "Users do not receive anonymous comments!", "Messages:User:1002": "The user has rejected all messages!", - "Messages:User:1003": "The user rejects the message you sent!" + "Messages:User:1003": "The user rejects the message you sent!", + "WelcomeToApplicationFormUser": "User :{0} welcome to join us!" } } \ No newline at end of file diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json index 0041a0ce4..9a326307b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Localization/Resources/zh-Hans.json @@ -6,6 +6,7 @@ "Messages:Group:1003": "管理员已禁止您发言!", "Messages:User:1001": "用户不接收匿名发言!", "Messages:User:1002": "用户已拒接所有消息!", - "Messages:User:1003": "用户拒绝您发送的消息!" + "Messages:User:1003": "用户拒绝您发送的消息!", + "WelcomeToApplicationFormUser": "用户:{0} 欢迎您的加入!" } } \ No newline at end of file diff --git a/vueJs/src/components/Notification/index.vue b/vueJs/src/components/Notification/index.vue index 7c7d78f14..0f4e776ac 100644 --- a/vueJs/src/components/Notification/index.vue +++ b/vueJs/src/components/Notification/index.vue @@ -134,8 +134,12 @@ export default class extends Vue { this.connection.invoke('GetNotification', ReadState.UnRead, 10).then(result => { console.log(result) result.items.forEach((notify: any) => { - const notification = notify.data.properties - notification.id = notify.id + const notification = new Notification() + notification.id = notify.data.properties.id + notification.title = notify.data.properties.title + notification.message = notify.data.properties.message + notification.datetime = notify.creationTime + notification.severity = notify.notificationSeverity this.notifications.push(notification) }) }) @@ -153,12 +157,17 @@ export default class extends Vue { private onNotificationReceived(data: any) { console.log('received signalr message...') console.log(data) - const notification = data.data.properties + const notification = new Notification() + notification.id = data.properties.id + notification.title = data.properties.title + notification.message = data.properties.message + notification.datetime = data.creationTime + notification.severity = data.notificationSeverity this.pushUserNotification(notification) this.$notify({ title: notification.title, message: notification.message, - type: this.getNofiyType(data.notificationSeverity) + type: this.getNofiyType(notification.severity) }) }