好友申请列表

lvxinran 2019-12-06 04:10:48 +08:00
parent 83338c7510
commit ca99629f91
1 changed files with 10 additions and 3 deletions

View File

@ -382,8 +382,10 @@ public class FriendLogic {
User friendUser; User friendUser;
FriendManager friendfriendManager; FriendManager friendfriendManager;
List<Integer> friendFriendList; List<Integer> friendFriendList;
List<Integer> alreadyFriendList = new ArrayList<>();
int nums =0; int nums =0;
for (Integer applyfriendId :applyFriends){ for (Integer applyfriendId :applyFriends){
// nums++;
friendUser = UserManager.getUser(applyfriendId); friendUser = UserManager.getUser(applyfriendId);
friendfriendManager = friendUser.getFriendManager(); friendfriendManager = friendUser.getFriendManager();
friendFriendList = friendfriendManager.getFriends(); friendFriendList = friendfriendManager.getFriends();
@ -393,22 +395,27 @@ public class FriendLogic {
if(friendManager.getBlackFriends().contains(applyfriendId)){ if(friendManager.getBlackFriends().contains(applyfriendId)){
continue; continue;
} }
if (friends.size()+nums>= maxFriends){ if (friends.size()+1> maxFriends){
// throw new ErrorCodeException(ErrorCode.FRIENDS_MAX); // throw new ErrorCodeException(ErrorCode.FRIENDS_MAX);
continue; continue;
} }
if (friendFriendList.size()>= maxFriends){ if (friendFriendList.size()>= maxFriends){
continue; continue;
} }
friendManager.delApplyFriend(applyfriendId); alreadyFriendList.add(applyfriendId);
// friendManager.delApplyFriend(applyfriendId);
friendfriendManager.addFriendId(uid); friendfriendManager.addFriendId(uid);
friendManager.addFriendId(applyfriendId); friendManager.addFriendId(applyfriendId);
UserManager.getUser(applyfriendId).getFriendManager().delMyApplyFriend(uid); UserManager.getUser(applyfriendId).getFriendManager().delMyApplyFriend(uid);
initFriendGriveAndRreward(applyfriendId, uid, friendManager, friendfriendManager); initFriendGriveAndRreward(applyfriendId, uid, friendManager, friendfriendManager);
sendFriendInfoIndication(uid,applyfriendId,2); sendFriendInfoIndication(uid,applyfriendId,2);
nums++;
updateFriendUserInfo(friendUser); updateFriendUserInfo(friendUser);
} }
if(!alreadyFriendList.isEmpty()){
for(Integer id:alreadyFriendList){
friendManager.delApplyFriend(id);
}
}
return nums; return nums;
} }