public async Task NewTenantRegisteredAsync(Tenant tenant) { var notificationData = new MessageNotificationData("有一个新租户注册了"); notificationData["tenancyName"] = tenant.TenancyName; await _notificationPublisher.PublishAsync(AppNotificationNames.NewTenantRegistered, notificationData); }
public async Task Send(SendPrivateEmailInput input) { var targetUser = await UserManager.FindByNameAsync(input.UserName); if (targetUser == null) { throw new UserFriendlyException("There is no such a user: "******"{0} sent you an email with subject: {1}", currentUser.UserName, input.Subject ) ); await _notificationPublisher.PublishAsync(NotificationNames.YouHaveAnEmail, notificationData, userIds : new[] { targetUser.Id }); } }
public async Task NewUserRegisteredAsync(User user) { var notificationData = new MessageNotificationData("New user registered."); notificationData["userName"] = user.UserName; notificationData["email"] = user.Email; // Publish to all subscribed users await _notificationPublisher.PublishAsync(NotificationDefinitions.Names.NewUserRegistered, notificationData); }
public async Task NewUserRegisteredAsync(User user) { var notificationData = new MessageNotificationData("有一个新用户注册了"); notificationData["userName"] = user.UserName; notificationData["emailAddress"] = user.EmailAddress; notificationData["phoneNumber"] = user.PhoneNumber; notificationData["content"] = $"用户名:【{user.UserName}】,手机号:【{user.PhoneNumber}】,邮箱:【{user.EmailAddress}】。"; await _notificationPublisher.PublishAsync(AppNotificationNames.NewUserRegistered, notificationData, tenantIds : new[] { user.TenantId }); }
public async Task SendUserMessageAsync(string notificationName, string type, string title, string content, string iconUrl, params long[] userIds) { var notificationData = new MessageNotificationData(title); notificationData["content"] = content; notificationData["type"] = type; if (!string.IsNullOrEmpty(iconUrl)) { notificationData["icon"] = iconUrl; } await _notificationPublisher.PublishAsync( notificationName, notificationData, severity : NotificationSeverity.Success, userIds : userIds.Select(x => new UserIdentifier(AbpSession.TenantId, x)).ToArray() ); }
/// <summary> /// 发送包含数据的通知 /// </summary> /// <param name="users"></param> /// <param name="notificationName"></param> /// <param name="data"></param> /// <param name="severity"></param> /// <returns></returns> private async Task SendMessageAsync(UserIdentifier[] users, string notificationName, MessageNotificationData data, NotificationSeverity severity = NotificationSeverity.Info) { long[] userIds = users.Select(p => p.UserId).ToArray(); var userEntities = await _userRepository.GetAllListAsync(p => userIds.Contains(p.Id)); await _notificationPublisher.PublishAsync(notificationName, data, null, severity, users); //foreach (var userEntity in userEntities) //{ // if (userEntity.UserType == UserType.Parent) // await _jPushParentManager.SendPushAsync(userEntity.PhoneNumber, notificationName, data.Message, notificationName); // else if (userEntity.UserType == UserType.Student) // await _jPushStudentManager.SendPushAsync(userEntity.PhoneNumber, notificationName, data.Message, notificationName); //} }