军团:创建军团需求

This commit is contained in:
luying
2021-09-13 16:47:50 +08:00
parent 63d28d1233
commit 73a15f0721
5 changed files with 15 additions and 2 deletions

View File

@@ -55,6 +55,11 @@ export class GuildHandler {
return resResult(STATUS.DAILY_REFRESH_GOLD_LACK);
}
// 检查是否充值过
if(ARMY.ARMY_CREAT_CONDITION > role.totalPay) {
return resResult(STATUS.GUILD_PAY_CONDITION);
}
await handleCost(roleId, sid, [getGoldObject(ARMY.ARMY_CREAT_COST)]);
// 创建公会

View File

@@ -38,7 +38,7 @@ export async function makeOrder(localOrderID: string, sid: string, orderInfo: Us
let payType = orderInfo.payType;//支付类型
let roleId = orderInfo.roleId;//角色
const roleInfo = await RoleModel.findByRoleId(roleId);
const roleInfo = await RoleModel.increaseTotalPay(roleId, price);
let rewardResult: any = { code: 0, data: null };

View File

@@ -49,4 +49,4 @@ export enum FRIEND_SHIP_SELECT {
GET_FRIEND_VALUE = 'friendValue friendLv'
}
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'equips', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins'];
export const ENTERY_ROLE_PICK = ['roleId', 'roleName', 'serverId', 'ce', 'topLineupCe', 'coin', 'lv', 'exp', 'vLv', 'gold', 'heros', 'equips', 'consumeGoods', 'title', 'teraphs', 'showLineup', 'heads', 'head', 'frames', 'frame', 'spines', 'spine', 'hasGuild', 'guildCode', 'todayZeroPoint', 'apJson', 'skins', 'totalPay'];

View File

@@ -175,6 +175,7 @@ export const STATUS = {
HAS_REACH_WISH_DONATE_COUNT_LIMIT: { code: 20929, simStr: '今日捐赠次数已用完,不能捐赠' },
HAS_RECEIVE_WISH_GOOD: { code: 20930, simStr: '玩家已经收到许愿物品' },
NOT_WISH_THE_QUALITY_GOODS: { code: 20931, simStr: '不能够许愿该品质的物品' },
GUILD_PAY_CONDITION: { code: 20932, simStr: '充值金额不足' },
GUILD_SCRIPT_IS_OPENED_TODAY: { code: 20950, simStr: '今日演武场已开启' },
GUILD_SCRIPT_NOT_OPENED: { code: 20951, simStr: '演武场未开启' },

View File

@@ -713,6 +713,13 @@ export default class Role extends BaseModel {
const role: RoleType = await RoleModel.findOneAndUpdate({ roleId }, { $inc: { equipCount: count } }, { new: true }).lean();
return role;
}
// 支付记录
public static async increaseTotalPay(roleId: string, price: number) {
const role: RoleType = await RoleModel.findOneAndUpdate({ roleId }, { $inc: { totalPay: price } }, { new: true }).lean();
return role;
}
}
export const RoleModel = getModelForClass(Role);