好友:当天申请过好友的不再在邀请列表显示
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Application, BackendSession, ChannelService } from "pinus";
|
||||
import { resResult, getRandEelm, getResStr, shouldRefresh } from "../../../pubUtils/util";
|
||||
import { resResult, getRandEelm, getResStr, shouldRefresh, getRefTime } from "../../../pubUtils/util";
|
||||
import { STATUS, ROLE_SELECT, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID, HERO_SELECT, EQUIP_SELECT, REDIS_KEY } from "../../../consts";
|
||||
import { RoleModel, RoleType } from "../../../db/Role";
|
||||
import { getBeforeHourSeconds } from "../../../pubUtils/timeUtil";
|
||||
@@ -43,6 +43,12 @@ export class FriendHandler {
|
||||
const { lv, serverId: myServerId, userInfo: { serverType: myServerType } } = await RoleModel.findByRoleId(roleId, ROLE_SELECT.GET_MY_SERVER);
|
||||
let allList = await RoleModel.getRecommedList(lv - FRIEND.FRIEND_RECONMMEND_LEVEL, lv + FRIEND.FRIEND_RECONMMEND_LEVEL, day);
|
||||
|
||||
// 筛掉自己今天申请过的人
|
||||
let applyList = await FriendApplyModel.getSentApplyList(roleId, getRefTime(new Date(), 0));
|
||||
allList = allList.filter(cur => {
|
||||
return !applyList.find(ccur => ccur.roleId == cur.roleId);
|
||||
});
|
||||
|
||||
let myFriendRelation = await FriendRelationModel.findFriendByRole(roleId, POPULATE_TYPE.NOT);
|
||||
|
||||
let myServerList = new Array<FriendRecommendParams>();
|
||||
|
||||
@@ -42,6 +42,13 @@ export default class FriendApply extends BaseModel {
|
||||
return list;
|
||||
}
|
||||
|
||||
// 获取自己发出的申请列表
|
||||
public static async getSentApplyList(roleId: string, time: Date) {
|
||||
const list: FriendApplyType[] = await FriendApplyModel.find({ frdRoleId: roleId, createdAt: { $gt: time } }, { _id: 0 })
|
||||
.lean({ getters: true });
|
||||
return list;
|
||||
}
|
||||
|
||||
// 根据applyCode获得申请
|
||||
public static async getApplyListByCode(applyCodeList: string[]) {
|
||||
const list: FriendApplyType[] = await FriendApplyModel.find({ applyCode: { $in: applyCodeList } }, { _id: 0 })
|
||||
|
||||
Reference in New Issue
Block a user