好友:好友排序以及一键赠送排序
This commit is contained in:
@@ -261,6 +261,7 @@ export class FriendHandler {
|
||||
let list = new Array<FriendListParam>();
|
||||
let myRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.FRIEND);
|
||||
let friendList = myRelation?myRelation.friends: [];
|
||||
|
||||
for(let friend of friendList) {
|
||||
let friendRole = <RoleType>friend.role;
|
||||
let friendShip = <FriendShipType>friend.friendShip;
|
||||
@@ -285,6 +286,16 @@ export class FriendHandler {
|
||||
list.push(param);
|
||||
}
|
||||
|
||||
list.sort((a, b) => {
|
||||
if(a.isOnline != b.isOnline) {
|
||||
return a.isOnline?1:-1
|
||||
}
|
||||
if(a.quitTime != b.quitTime) {
|
||||
return b.quitTime - a.quitTime
|
||||
}
|
||||
return a.friendValue - b.friendValue;
|
||||
});
|
||||
|
||||
let { friendCnt = 0, blockCnt = 0 } = role;
|
||||
let frdPointRec = await FriendPointModel.getFrdPointRecToday(roleId, FRIEND_DROP_TYPE.SEND_GIFT);
|
||||
let { cnt: todayReceiveCnt = 0, sendCnt: todaySendCnt = 0 } = frdPointRec||{};
|
||||
@@ -452,7 +463,7 @@ export class FriendHandler {
|
||||
|
||||
let { roleId: hisRoleId } = msg;
|
||||
|
||||
let myRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.FRIENDSHIP); // 好友关系,只有friendship被populate了
|
||||
let myRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.FRIEND); // 好友关系,只有friendship被populate了
|
||||
let friends = myRelation?myRelation.friends: [];
|
||||
let arr = new Array<Relation>();
|
||||
if(hisRoleId != '') {
|
||||
@@ -463,7 +474,7 @@ export class FriendHandler {
|
||||
} else {
|
||||
arr = friends;
|
||||
}
|
||||
let canSendList = sortByBeSentHeart(roleId, arr);
|
||||
let canSendList = await sortByBeSentHeart(roleId, arr);
|
||||
|
||||
let {lv} = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_LV);
|
||||
let dicFriendLv = gameData.roleFriend.get(lv);
|
||||
@@ -515,7 +526,7 @@ export class FriendHandler {
|
||||
|
||||
let { roleId: hisRoleId } = msg;
|
||||
|
||||
let myRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.FRIENDSHIP); // 好友关系,只有friendship被populate了
|
||||
let myRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.FRIEND); // 好友关系,只有friendship被populate了
|
||||
let friends = myRelation?myRelation.friends: [];
|
||||
let arr = new Array<Relation>();
|
||||
if(hisRoleId != '') {
|
||||
@@ -526,7 +537,7 @@ export class FriendHandler {
|
||||
} else {
|
||||
arr = friends;
|
||||
}
|
||||
let canReceiveList = sortByBeSentHeart(roleId, arr);
|
||||
let canReceiveList = await sortByBeSentHeart(roleId, arr);
|
||||
|
||||
let {lv} = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_LV);
|
||||
let dicFriendLv = gameData.roleFriend.get(lv);
|
||||
|
||||
Reference in New Issue
Block a user