商店:添加名将擂台限制

This commit is contained in:
luying
2022-08-12 14:19:35 +08:00
parent 8a1ce473ed
commit 40e228ca42
4 changed files with 13 additions and 1 deletions

View File

@@ -12,6 +12,7 @@ import { DicShop } from "../pubUtils/dictionary/DicShop";
import { BackendSession } from "pinus";
import { ActivityModelType } from "../db/Activity";
import { addItems } from "./role/rewardService";
import { LadderMatchModel } from "../db/LadderMatch";
export async function getAllShopList(roleId: string, serverId: number) {
let userShopRecs = await UserShopModel.findByRoleId(roleId);
@@ -157,7 +158,12 @@ export async function checkShopItemCanBuy(activityId: number, shopItemId: number
return STATUS.LV_LIMIT;
}
}
if(dicShopItem.ranklimit) {
let ladder = await LadderMatchModel.findByRoleId(roleId);
if(ladder.historyRank < dicShopItem.ranklimit) {
return STATUS.LADDER_LV_LIMIT;
}
}
if(dicShopItem.purchaseLimit != -1) {
if(vipStartTime > 0 && dicShopItem.vipPurchaseLimit != -1) {
if(buyCount + count > dicShopItem.purchaseLimit + dicShopItem.vipPurchaseLimit) {

View File

@@ -417,6 +417,7 @@ export const STATUS = {
HERO_NOT_MAX: { code: 30904, simStr: '该武将未升满星' },
LV_LIMIT: { code: 30905, simStr: '玩家等级不足' },
CAN_NOT_PURCHASE: { code: 30906, simStr: '该商品不可使用该购买方式' },
LADDER_LV_LIMIT: { code: 30907, simStr: '名将擂台等级不足' },
// 任务相关 31001-31100
TASK_NOT_REACH_CONDITION: { code: 31001, simStr: '任务不满足条件' },

View File

@@ -19,6 +19,7 @@ interface ShopItemInDb {
num: number;
guildLvLimit: number;
lvLimit: number;
ranklimit: number;
purchaseLimit: number;
vipPurchaseLimit: number;
refreshType: number;
@@ -75,6 +76,7 @@ export class ShopDicData {
num: number;
guildLvLimit: number;
lvLimit: number;
ranklimit: number;
purchaseLimit: number;
vipPurchaseLimit: number;
refreshType: SHOP_REFRESH_TYPE;
@@ -94,6 +96,7 @@ export class ShopDicData {
this.num = obj.num;
this.guildLvLimit = obj.guildLvLimit;
this.lvLimit = obj.lvLimit;
this.ranklimit = obj.ranklimit;
this.purchaseLimit = obj.purchaseLimit;
this.vipPurchaseLimit = obj.vipPurchaseLimit;
this.refreshType = obj.refreshType;

View File

@@ -20,6 +20,8 @@ export interface DicShop {
readonly guildLvLimit: number;
// 玩家等级需求
readonly lvLimit: number;
// 名将擂台需求
readonly ranklimit: number;
// 购买次数限制
readonly purchaseLimit: number;
// vip购买次数限制