🐞 fix(寻宝): 寻宝有时有问题
This commit is contained in:
@@ -3,6 +3,7 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
|
||||
import { EXTERIOR } from '../pubUtils/dicParam';
|
||||
import { nowSeconds } from '../pubUtils/timeUtil';
|
||||
import { RoleUpdate } from './Role';
|
||||
import { COM_TEAM_STATUS } from '../consts';
|
||||
|
||||
export class ComRoleStatusHero {
|
||||
@prop({ required: true })
|
||||
@@ -241,6 +242,10 @@ export default class ComBattleTeam extends BaseModel {
|
||||
return team;
|
||||
}
|
||||
|
||||
public static async checkHasTeamByRoleId(roleId: string) {
|
||||
return await ComBattleTeamModel.exists({ roleIds: { $in: [roleId] }, status: COM_TEAM_STATUS.FIGHTING });
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user