军团&好友:推荐列表做一下乱序

This commit is contained in:
luying
2021-02-23 16:46:52 +08:00
parent 92d223314b
commit 93eaee5032
6 changed files with 21 additions and 9 deletions

View File

@@ -44,7 +44,7 @@ export default class FriendApply extends BaseModel {
// 获取自己发出的申请列表
public static async getSentApplyList(roleId: string, time: Date) {
const list: FriendApplyType[] = await FriendApplyModel.find({ frdRoleId: roleId, createdAt: { $gt: time } }, { _id: 0 })
const list: FriendApplyType[] = await FriendApplyModel.find({ frdRoleId: roleId, updatedAt: { $gt: time } }, { _id: 0 })
.lean({ getters: true });
return list;
}

View File

@@ -447,7 +447,7 @@ export default class Role extends BaseModel {
*/
public static async getInviteList(time: number, serverId: number) {
const result = await RoleModel.find({ loginTime: { $gt: time }, hasGuild: false, serverId })
.select('roleId roleName ce headHid sHid lv title job quitTime')
.select({roleId: 1, roleName: 1,ce: 1,headHid: 1,sHid: 1,lv: 1,title: 1,job: 1,quitTime: 1, _id: 0})
.sort({quitTime: -1, lv: -1, ce: -1})
.limit(100).lean({getters: true});
return result;