好友:寻宝关系加成及黑名单屏蔽
This commit is contained in:
@@ -56,7 +56,9 @@ export default class FriendRelation extends BaseModel {
|
||||
document.populate('friends.friendShip', null, 'FriendShip');
|
||||
}
|
||||
|
||||
let result: FriendRelationType = await document;
|
||||
let result: FriendRelationType = await document.lean({ getters: true, virtuals: true });;
|
||||
|
||||
console.log(JSON.stringify(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -79,6 +81,13 @@ export default class FriendRelation extends BaseModel {
|
||||
return result
|
||||
}
|
||||
|
||||
public static async isInBlackList(roleId: string, hisRoleId: string) {
|
||||
let result = await FriendRelationModel.find({
|
||||
$or: [{ roleId, 'blacklist.roleId': hisRoleId}, { hisRoleId, 'blacklist.roleId': roleId}]
|
||||
}).lean();
|
||||
return result.length > 0;
|
||||
}
|
||||
|
||||
public static async deleteAccount(roleId: string) {
|
||||
let result = await FriendRelationModel.deleteMany({ roleId });
|
||||
await FriendRelationModel.updateMany({}, { $pull: { friends: { roleId }, blacklist: { roleId } }});
|
||||
|
||||
Reference in New Issue
Block a user