好友:好友排序以及一键赠送排序
This commit is contained in:
@@ -96,6 +96,11 @@ export default class FriendRelation extends BaseModel {
|
||||
return result.length > 0;
|
||||
}
|
||||
|
||||
public static async updateInfo(roleId: string, update: friendShipUpdate) {
|
||||
const result = await FriendRelationModel.findOneAndUpdate({ roleId }, {$set: update}, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async deleteAccount(roleId: string) {
|
||||
let result = await FriendRelationModel.deleteMany({ roleId });
|
||||
await FriendRelationModel.updateMany({}, { $pull: { friends: { roleId }, blacklist: { roleId } }});
|
||||
@@ -105,4 +110,5 @@ export default class FriendRelation extends BaseModel {
|
||||
|
||||
export const FriendRelationModel = getModelForClass(FriendRelation);
|
||||
|
||||
export interface FriendRelationType extends Pick<DocumentType<FriendRelation>, keyof FriendRelation> { };
|
||||
export interface FriendRelationType extends Pick<DocumentType<FriendRelation>, keyof FriendRelation> { };
|
||||
type friendShipUpdate = Partial<FriendRelationType>; // 将所有字段变成可选项
|
||||
@@ -5,7 +5,6 @@ import { genCode } from '../pubUtils/util';
|
||||
import { GUILD_STRUCTURE, GUILD_STATUS, GUILD_PER_PAGE, GUILD_SELECT } from '../consts';
|
||||
import { getCurWeekTime, nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { reduceCe } from '../pubUtils/util';
|
||||
import { now } from 'underscore';
|
||||
|
||||
class Structure {
|
||||
@prop({ required: true })
|
||||
|
||||
@@ -232,7 +232,7 @@ export default class Role extends BaseModel {
|
||||
}
|
||||
|
||||
public static async findByUid(uid: number, serverId: number, select?: string, getters = false) {
|
||||
const role: RoleType = await RoleModel.findOneAndUpdate({ 'userInfo.uid': uid, serverId }, { loginTime: nowSeconds() }, { new: true }).select(select).lean({ getters });
|
||||
const role: RoleType = await RoleModel.findOneAndUpdate({ 'userInfo.uid': uid, serverId }, { loginTime: nowSeconds(), quitTime: nowSeconds() }, { new: true }).select(select).lean({ getters });
|
||||
return role;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user