寻宝中移除队友或者队友离开队伍

This commit is contained in:
liangtongchuan
2020-11-21 00:18:34 +08:00
parent 7d0900c321
commit 365aa385b8
3 changed files with 39 additions and 1 deletions

View File

@@ -79,6 +79,11 @@ export default class ComBattleTeam extends BaseModel {
return team;
}
public static async removeRole(teamCode: string, roleIdToRm: string, lean = true) {
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode: teamCode }, {$pull: {roleIds: roleIdToRm, roleStatus: {roleId: roleIdToRm}}}, {new: true}).lean(lean);
return team;
}
public static async updateHeroes(teamCode: string, roleId: string, heroes: Array<number>, lean = true) {
const team = await ComBattleTeamModel.findOneAndUpdate({ teamCode, 'roleStatus.roleId': roleId}, {$set: {'roleStatus.$.heroes': heroes}}, {new: true}).lean(lean);
return team;