private async Task SetTeamNotify(long userId, Team dbTeam, UserActionEnum userActionToSet) { if (userActionToSet == UserActionEnum.ConsideringOffer) { await notificationSender.Send(userId, NotifyType.Add, "Вас пригласили в команду {0}", dbTeam.Image.DataURL, NoticeItem.Team(dbTeam)); } }
/// <summary> /// 记录用户操作日志 登录、注册、登出、更新等操作 /// </summary> /// <param name="Action"></param> /// <param name="UserId"></param> /// <param name="Content"></param> public static void Log(UserActionEnum Action, Guid?UserId, string Content) { using (var client = new UserAccountClient()) { client.LogUserActionAsync(new UserLog() { Action = Action, UserId = UserId.HasValue ? UserId.Value : Guid.Empty, Content = Content, Channel = ChannelEnum.H5, ChannelIn = nameof(ChannelIn.H5), Ip = HttpContext.Current.Request.UserIp() }); } }
private async Task RejectedOrRemoveUserNotify(long userId, Team team, UserActionEnum userAction) { var requestUserId = HttpContext.User.Identity.Name; var teamItem = NoticeItem.Team(team); var user = await context.Users.FirstOrDefaultAsync(u => u.Id == userId); if (requestUserId != userId.ToString()) { switch (userAction) { case UserActionEnum.RejectedTeamRequest: await notificationSender.Send(userId, NotifyType.Destructive, "Команда {0} отклонила вашу заявку", team.Image.DataURL, teamItem); break; case UserActionEnum.QuitTeam: await notificationSender.Send(userId, NotifyType.Destructive, "Команда {0} исключила вас из списка участников", team.Image.DataURL, teamItem); break; } } else { var items = new List <NoticeItem> { NoticeItem.User(user), teamItem }; var ownerId = await context.Teams.GetOwnerId(team.Id); switch (userAction) { case UserActionEnum.RejectedTeamRequest: await notificationSender.Send(ownerId, NotifyType.Destructive, "{0} отказался от приглашения в команду {1}", user.Photo100, items); break; case UserActionEnum.QuitTeam: await notificationSender.Send(ownerId, NotifyType.Destructive, "{0} вышел из команды {1}", user.Photo100, items); break; } } }
private async Task JoinTeamNotify(long userId, Team team, User user, UserActionEnum wasAction) { var teamItem = NoticeItem.Team(team); var ownerId = await context.Teams.GetOwnerId(team.Id); switch (wasAction) { case UserActionEnum.ConsideringOffer: await notificationSender.Send(ownerId, NotifyType.Destructive, "{0} принял приглашение вступить в команду {1}", user.Photo100, NoticeItem.User(user), teamItem); break; case UserActionEnum.SentRequest: await notificationSender.Send(userId, NotifyType.Destructive, "Команда {0} добавила вас в список участников", team.Image.DataURL, teamItem); break; } }
internal SyncEventArgs(string message, UserActionEnum action) { Message = message; UserAction = action; }
public UserAction(UserActionEnum userActionEnum) { Name = userActionEnum; IsChosen = false; }
internal SyncEventArgs(string message, UserActionEnum action) { Message = message; UserAction = action; }
private static async Task <string> GenerateVerificationCode(string phoneNumber, UserActionEnum userAction) { try { using (var client = new UserAccountClient()) { var result = await client.GenerateVerificationCodeAsync(phoneNumber, userAction); result.ThrowIfException(true); if (result.Success) { return(result.Result); } } } catch (Exception exception) { WebLog.LogException(exception); } return(null); }