军团&好友:推荐列表做一下乱序
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -20,7 +20,7 @@ let arr = JSON.parse(str);
|
||||
export const dicGuildActiveDayReward = new Map<number, DicGuildActiveDayReward>();
|
||||
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward)
|
||||
o.reward = parseGoodStr(o.Reward)
|
||||
dicGuildActiveDayReward.set(o.id, o);
|
||||
});
|
||||
arr = undefined;
|
||||
@@ -293,6 +293,15 @@ export function getRandEelm(source: Array<any> = [], cnt = 1): Array<any> {
|
||||
return source.filter((_item, idx) => idxs.has(idx));
|
||||
}
|
||||
|
||||
/**
|
||||
* 不改变原数组长度,将内部元素打乱
|
||||
* @param source
|
||||
*/
|
||||
export function sortArrRandom(source = []) {
|
||||
let arr = deepCopy(source);
|
||||
return arr.sort(() => { return Math.random()-0.5; });
|
||||
}
|
||||
|
||||
/**
|
||||
* 在给定数值的浮动范围中随机一个值
|
||||
* @param base 基础数值
|
||||
|
||||
Reference in New Issue
Block a user