//玩家退出亲友圈 被管理踢 或者自己退都走这
        public static async void SucceedOutriendsCircle(this FriendsCircle friendsCircle, long userId)
        {
            if (friendsCircle.CreateUserId == userId)
            {
                return;
            }
            UserInFriendsCircle userInFriendsCircle = await FriendsCircleComponent.Ins.QueryUserInFriendsCircle(userId);

            if (userInFriendsCircle.FriendsCircleIdList.Contains(friendsCircle.FriendsCircleId))
            {
                userInFriendsCircle.FriendsCircleIdList.Remove(friendsCircle.FriendsCircleId);
            }
            await FriendsCircleComponent.Ins.SaveDB(userInFriendsCircle);

            FriendsCirleMemberInfo friendsCirleMemberInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(friendsCircle.FriendsCircleId);

            if (friendsCirleMemberInfo.MemberList.Contains(userId))
            {
                friendsCirleMemberInfo.MemberList.Remove(userId);
            }
            await FriendsCircleComponent.Ins.SaveDB(friendsCirleMemberInfo);

            friendsCircle.TotalNumber--;
            await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
        }
Exemple #2
0
        public static UserInFriendsCircle Create(long userId)
        {
            UserInFriendsCircle userInFriendsCircle = ComponentFactory.Create <UserInFriendsCircle>();

            userInFriendsCircle.UserId = userId;
            return(userInFriendsCircle);
        }
        //玩家成功加入亲友圈
        public static async Task SucceedJoinFriendsCircle(this FriendsCircle friendsCircle, long userId)
        {
            UserInFriendsCircle userInFriendsCircle = await FriendsCircleComponent.Ins.QueryUserInFriendsCircle(userId);

            userInFriendsCircle.FriendsCircleIdList.Add(friendsCircle.FriendsCircleId);
            await FriendsCircleComponent.Ins.SaveDB(userInFriendsCircle);

            FriendsCirleMemberInfo friendsCirleMemberInfo = await FriendsCircleComponent.Ins.QueryFriendsCircleMember(friendsCircle.FriendsCircleId);

            friendsCirleMemberInfo.MemberList.Add(userId);
            await FriendsCircleComponent.Ins.SaveDB(friendsCirleMemberInfo);

            friendsCircle.TotalNumber++;
            await FriendsCircleComponent.Ins.SaveDB(friendsCircle);
        }