商店:添加名将擂台限制
This commit is contained in:
@@ -12,6 +12,7 @@ import { DicShop } from "../pubUtils/dictionary/DicShop";
|
|||||||
import { BackendSession } from "pinus";
|
import { BackendSession } from "pinus";
|
||||||
import { ActivityModelType } from "../db/Activity";
|
import { ActivityModelType } from "../db/Activity";
|
||||||
import { addItems } from "./role/rewardService";
|
import { addItems } from "./role/rewardService";
|
||||||
|
import { LadderMatchModel } from "../db/LadderMatch";
|
||||||
|
|
||||||
export async function getAllShopList(roleId: string, serverId: number) {
|
export async function getAllShopList(roleId: string, serverId: number) {
|
||||||
let userShopRecs = await UserShopModel.findByRoleId(roleId);
|
let userShopRecs = await UserShopModel.findByRoleId(roleId);
|
||||||
@@ -157,7 +158,12 @@ export async function checkShopItemCanBuy(activityId: number, shopItemId: number
|
|||||||
return STATUS.LV_LIMIT;
|
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(dicShopItem.purchaseLimit != -1) {
|
||||||
if(vipStartTime > 0 && dicShopItem.vipPurchaseLimit != -1) {
|
if(vipStartTime > 0 && dicShopItem.vipPurchaseLimit != -1) {
|
||||||
if(buyCount + count > dicShopItem.purchaseLimit + dicShopItem.vipPurchaseLimit) {
|
if(buyCount + count > dicShopItem.purchaseLimit + dicShopItem.vipPurchaseLimit) {
|
||||||
|
|||||||
@@ -417,6 +417,7 @@ export const STATUS = {
|
|||||||
HERO_NOT_MAX: { code: 30904, simStr: '该武将未升满星' },
|
HERO_NOT_MAX: { code: 30904, simStr: '该武将未升满星' },
|
||||||
LV_LIMIT: { code: 30905, simStr: '玩家等级不足' },
|
LV_LIMIT: { code: 30905, simStr: '玩家等级不足' },
|
||||||
CAN_NOT_PURCHASE: { code: 30906, simStr: '该商品不可使用该购买方式' },
|
CAN_NOT_PURCHASE: { code: 30906, simStr: '该商品不可使用该购买方式' },
|
||||||
|
LADDER_LV_LIMIT: { code: 30907, simStr: '名将擂台等级不足' },
|
||||||
|
|
||||||
// 任务相关 31001-31100
|
// 任务相关 31001-31100
|
||||||
TASK_NOT_REACH_CONDITION: { code: 31001, simStr: '任务不满足条件' },
|
TASK_NOT_REACH_CONDITION: { code: 31001, simStr: '任务不满足条件' },
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ interface ShopItemInDb {
|
|||||||
num: number;
|
num: number;
|
||||||
guildLvLimit: number;
|
guildLvLimit: number;
|
||||||
lvLimit: number;
|
lvLimit: number;
|
||||||
|
ranklimit: number;
|
||||||
purchaseLimit: number;
|
purchaseLimit: number;
|
||||||
vipPurchaseLimit: number;
|
vipPurchaseLimit: number;
|
||||||
refreshType: number;
|
refreshType: number;
|
||||||
@@ -75,6 +76,7 @@ export class ShopDicData {
|
|||||||
num: number;
|
num: number;
|
||||||
guildLvLimit: number;
|
guildLvLimit: number;
|
||||||
lvLimit: number;
|
lvLimit: number;
|
||||||
|
ranklimit: number;
|
||||||
purchaseLimit: number;
|
purchaseLimit: number;
|
||||||
vipPurchaseLimit: number;
|
vipPurchaseLimit: number;
|
||||||
refreshType: SHOP_REFRESH_TYPE;
|
refreshType: SHOP_REFRESH_TYPE;
|
||||||
@@ -94,6 +96,7 @@ export class ShopDicData {
|
|||||||
this.num = obj.num;
|
this.num = obj.num;
|
||||||
this.guildLvLimit = obj.guildLvLimit;
|
this.guildLvLimit = obj.guildLvLimit;
|
||||||
this.lvLimit = obj.lvLimit;
|
this.lvLimit = obj.lvLimit;
|
||||||
|
this.ranklimit = obj.ranklimit;
|
||||||
this.purchaseLimit = obj.purchaseLimit;
|
this.purchaseLimit = obj.purchaseLimit;
|
||||||
this.vipPurchaseLimit = obj.vipPurchaseLimit;
|
this.vipPurchaseLimit = obj.vipPurchaseLimit;
|
||||||
this.refreshType = obj.refreshType;
|
this.refreshType = obj.refreshType;
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ export interface DicShop {
|
|||||||
readonly guildLvLimit: number;
|
readonly guildLvLimit: number;
|
||||||
// 玩家等级需求
|
// 玩家等级需求
|
||||||
readonly lvLimit: number;
|
readonly lvLimit: number;
|
||||||
|
// 名将擂台需求
|
||||||
|
readonly ranklimit: number;
|
||||||
// 购买次数限制
|
// 购买次数限制
|
||||||
readonly purchaseLimit: number;
|
readonly purchaseLimit: number;
|
||||||
// vip购买次数限制
|
// vip购买次数限制
|
||||||
|
|||||||
Reference in New Issue
Block a user