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

View File

@@ -28,7 +28,7 @@ import { DATA_NAME } from '../consts/dataName';
export async function checkAuth(func: number, roleId: string, code?: string, userGuild?: UserGuildType) { export async function checkAuth(func: number, roleId: string, code?: string, userGuild?: UserGuildType) {
const auth = await UserGuildModel.getMyAuth(roleId, code, userGuild); const auth = await UserGuildModel.getMyAuth(roleId, code, userGuild);
const dicGuildAuth = gameData.guildAuth.get(func); const dicGuildAuth = gameData.guildAuth.get(func);
// console.log(auth, dicGuildAuth) console.log('*checkAuth*', auth, dicGuildAuth)
if(!dicGuildAuth) return false; if(!dicGuildAuth) return false;
return dicGuildAuth.includes(auth); return dicGuildAuth.includes(auth);