Beispiel #1
0
 private async Task UpdateRedisAsync(Domain.AggregatesModel.GroupAggregate.Group group)
 {
     try
     {
         // 向redis写入群
         await _chatServerRedisService.WriteGroupAsync(group);
     }
     catch (Exception ex)
     {
         _logger.LogError("Redis Error: {@RedisError}", ex);
     }
 }
Beispiel #2
0
        private async Task UpdateRedisAsync(Domain.AggregatesModel.GroupAggregate.Group group)
        {
            try
            {
                // 向redis写入群
                await _chatServerRedisService.WriteGroupAsync(group);

                // 发布系统消息
                await _chatServerRedisService.WriteGroupMessageAsync(group, SysMsgType.GROUP_INFO_CHANGED);
            }
            catch (Exception ex)
            {
                _logger.LogError("Redis Error: {@RedisError}", ex);
            }
        }
Beispiel #3
0
        private async Task UpdateRedisAsync(Domain.AggregatesModel.GroupAggregate.Group group)
        {
            try
            {
                // 向redis写入群
                await _chatServerRedisService.WriteGroupAsync(group);

                // 向redis写入群成员
                foreach (var groupUser in group.GroupUsers)
                {
                    await _chatServerRedisService.WriteGroupMemberAsync(groupUser.UserId.Value, group.ChatServerGroupId, 0);
                }

                // 发布系统消息
                await _chatServerRedisService.WriteGroupMessageAsync(group, SysMsgType.GROUP_CREATED);
            }
            catch (Exception ex)
            {
                _logger.LogError("Redis Error: {@RedisError}", ex);
            }
        }
Beispiel #4
0
        private async Task UpdateRedisAsync(ChangeGroupOwnerCommand request, Domain.AggregatesModel.GroupAggregate.Group group, Guid operatorId)
        {
            try
            {
                // 向redis写入群
                await _chatServerRedisService.WriteGroupAsync(group);

                // 发布系统消息
                var changedUsers = await _userRepository.GetUsersAsync(new List <Guid> {
                    request.NewOwnerId
                });

                var operatorUser = await _userRepository.GetByIdAsync(operatorId);

                await _chatServerRedisService.WriteGroupMemberMessageAsync(group, SysMsgType.OWNER_CHANGED, changedUsers, operatorUser);
            }
            catch (Exception ex)
            {
                _logger.LogError("Redis Error: {@RedisError}", ex);
            }
        }