public async Task SubscribeAsync(long userId, string notificationName, EntityIdentifier entityIdentifier = null) { await _store.InsertSubscriptionAsync( new NotificationSubscriptionInfo( userId, notificationName, entityIdentifier ) ); }
public async Task SubscribeAsync(long userId, string notificationName, EntityIdentifier entityIdentifier = null) { if (await IsSubscribedAsync(userId, notificationName, entityIdentifier)) { return; } await _notificationStore.InsertSubscriptionAsync( new NotificationSubscriptionInfo( _guidGenerator.Create(), userId, notificationName, entityIdentifier)); }
/// <summary> /// 添加所有用户订阅通知(NotificationName) /// (激活状态,未删除的用户) /// </summary> /// <param name="notificationInfo"></param> /// <returns></returns> public async Task AddAllUserSubscriptionAsync(SysNotificationInfo notificationInfo) { var userList = _userInfoRepository.GetAllList(p => p.IsActive == true); foreach (var item in userList) { NotificationSubscriptionInfo subscription = new NotificationSubscriptionInfo() { TenantId = 1, UserId = item.Id, NotificationName = notificationInfo.NotificationName }; await _notificationStore.InsertSubscriptionAsync(subscription); } }
public async Task SubscribeAsync(UserIdentifier user, string notificationName, EntityIdentifier entityIdentifier = null) { if (await IsSubscribedAsync(user, notificationName, entityIdentifier)) { return; } await _store.InsertSubscriptionAsync( new NotificationSubscriptionInfo( user.TenantId, user.UserId, notificationName, entityIdentifier ) ); }
/// <summary> /// 订阅通知 /// </summary> /// <param name="list">=订阅通知的用户集合</param> /// <param name="notificationName">=通知名称</param> /// <returns></returns> public async Task InsertSubscriptionAsync(List <long> userList, string notificationName) { foreach (var user in userList) { //判断是否已经订阅 var isSubscribed = await _notificationStore.IsSubscribedAsync(new UserIdentifier(null, user), notificationName, null, null); if (!isSubscribed) { await _notificationStore.InsertSubscriptionAsync(new NotificationSubscriptionInfo() { UserId = user, TenantId = AbpSession.TenantId, NotificationName = notificationName }); } } }
public async Task SubscribeAsync(Guid userId, string notificationName, NotificationEntityIdentifier entityIdentifier = null) { if (await IsSubscribedAsync(userId, notificationName, entityIdentifier)) { return; } await _store.InsertSubscriptionAsync( new NotificationSubscriptionInfo( userId, notificationName, entityIdentifier == null ? null : entityIdentifier.Type.FullName, entityIdentifier == null ? null : entityIdentifier.Id, _clock.Now, _currentTenant.Id ) ); }
/// <summary> /// 订阅通知 /// </summary> /// <param name="list">=订阅通知的用户集合</param> /// <param name="notificationName">=通知名称</param> /// <returns></returns> public async Task InsertSubscriptionAsync(RequestParam <List <SysUserNotification> > requestParam) { Check.NotNull(requestParam.Params, nameof(requestParam.Params)); foreach (var user in requestParam.Params) { //判断是否已经订阅 var isSubscribed = await _notificationStore.IsSubscribedAsync(new UserIdentifier(null, user.UserId.Value), user.NotificationName, null, null); if (!isSubscribed) { await _notificationStore.InsertSubscriptionAsync(new NotificationSubscriptionInfo() { UserId = user.UserId.Value, TenantId = AbpSession.TenantId, NotificationName = user.NotificationName }); } } }
public async Task SubscribeAsync(NotificationSubscriptionOptions options) { CheckNotificationName(options.NotificationName); await _store.InsertSubscriptionAsync(options); }