军团:fix拒绝邀请未删除条目,升级建筑去锁

This commit is contained in:
luying
2021-02-23 11:48:17 +08:00
parent 6759a7dcb1
commit 53b873941e
4 changed files with 14 additions and 29 deletions
-1
View File
@@ -5,7 +5,6 @@ export enum DATA_NAME {
GUILD = 'Guild',
GUILD_REFINE = 'GuildRefine',
GUILD_ASSIST_REFINE = 'GuildAssistRefine',
UP_STRUCTURE = 'GuildStructure',
JOIN_GUILD = 'JoinGuild',
REFRESH_ACTIVE = 'GuildRefActive',
WEEKLY_GUILD_SUM = 'WeeklyGuildSum', // 每周结算活跃和奖励
+3 -3
View File
@@ -182,12 +182,12 @@ export default class Guild extends BaseModel {
return result;
}
public static async upStructure(code: string, id: number, select?: string) {
public static async upStructure(code: string, id: number, cost: number, select?: string) {
if (id == GUILD_STRUCTURE.ARMY_CENTER) {
const result: GuildType = await GuildModel.findOneAndUpdate({ code, 'structure.id': id }, { $inc: { 'structure.$.lv': 1, lv: 1 }, $set: { isMemberMax: false } }, { new: true }).select(select).lean();
const result: GuildType = await GuildModel.findOneAndUpdate({ code, 'structure.id': id, fund: { $gte: cost } }, { $inc: { 'structure.$.lv': 1, lv: 1, fund: -1 * cost }, $set: { isMemberMax: false } }, { new: true }).select(select).lean();
return result;
} else {
const result: GuildType = await GuildModel.findOneAndUpdate({ code, 'structure.id': id }, { $inc: { 'structure.$.lv': 1 } }, { new: true }).select(select).lean();
const result: GuildType = await GuildModel.findOneAndUpdate({ code, 'structure.id': id, fund: { $gte: cost } }, { $inc: { 'structure.$.lv': 1, fund: -1 * cost } }, { new: true }).select(select).lean();
return result;
}
}
+4 -4
View File
@@ -46,8 +46,8 @@ export default class UserGuildApply extends BaseModel {
}
// 根据唯一code批量删除
public static async deleteApplyByApplyCode(applyCodeList: string[]) {
const result = await UserGuildApplyModel.deleteMany({ applyCode: { $in: applyCodeList}, type: GUILD_APPLY_TYPE.APPLY });
public static async deleteByApplyCode(applyCodeList: string[]) {
const result = await UserGuildApplyModel.deleteMany({ applyCode: { $in: applyCodeList} });
return result;
}
@@ -70,7 +70,7 @@ export default class UserGuildApply extends BaseModel {
}
// 查询公会收到的申请
public static async getListByGuild(code: string, lastApplyCode: string) {
public static async findApplyByGuild(code: string, lastApplyCode: string) {
let condition = { guildCode: code, type: GUILD_APPLY_TYPE.APPLY };
if(lastApplyCode) {
const lastApply = await this.findByCode(lastApplyCode);
@@ -85,7 +85,7 @@ export default class UserGuildApply extends BaseModel {
}
// 查询玩家的邀请列表
public static async getListByRole(roleId: string, lastApplyCode: string) {
public static async findInviteByRole(roleId: string, lastApplyCode: string) {
let condition = { roleId, type: GUILD_APPLY_TYPE.INVITE };
if(lastApplyCode) {
const lastApply = await this.findByCode(lastApplyCode);