好友:fix 推荐列表数量少时无法获取

This commit is contained in:
luying
2021-02-22 12:35:42 +08:00
parent 87049d9f46
commit 9b1fa777cd
2 changed files with 7 additions and 2 deletions

View File

@@ -49,6 +49,7 @@ export class FriendHandler {
let otherServerList = new Array<FriendRecommendParams>();
for(let role of allList) {
let type = getRecommendType(myFriendRelation, roleId, role.roleId);
console.log('****', type, roleId, role.roleId)
if(type == FRIEND_RELATION_TYPE.NORMAL) {
let param = new FriendRecommendParams(role);
param.setType(type);
@@ -74,7 +75,11 @@ export class FriendHandler {
let list2:FriendRecommendParams[] = getRandEelm(otherServerList, otherServerLen);
if(list2.length < FRIEND.FRIEND_RECONMMEND_NUM - myServerLen) {
list1 = getRandEelm(myServerList, FRIEND.FRIEND_RECONMMEND_NUM - list2.length);
if(myServerList.length <= FRIEND.FRIEND_RECONMMEND_NUM - list2.length) {
list1 = myServerList;
} else {
list1 = getRandEelm(myServerList, FRIEND.FRIEND_RECONMMEND_NUM - list2.length);
}
}
let list = list1.concat(list2);