寻宝:点击头像接口设置机器人

This commit is contained in:
luying
2021-08-25 16:57:11 +08:00
parent 14eac59d43
commit fe78c998b2
13 changed files with 98 additions and 31 deletions
+5
View File
@@ -183,6 +183,11 @@ export default class ComBattleTeam extends BaseModel {
return team;
}
public static async findByRoleId(roleId: string) {
const team: ComBattleTeamType = await ComBattleTeamModel.findOne({ roleIds: { $in: [roleId] }}).lean();
return team;
}
public static async addRole(teamCode: string, roleStatus: RoleStatus, lean = true) {
const team: ComBattleTeamType = await ComBattleTeamModel.findOneAndUpdate({ teamCode, roleCnt: { $lte: 2 } }, {$push: {roleIds: roleStatus.roleId, roleStatus}, $inc: {roleCnt: 1}}, {new: true}).lean(lean);
return team;