diff --git a/game-server/app/servers/role/handler/shopHandler.ts b/game-server/app/servers/role/handler/shopHandler.ts index 735a6be06..58ca1e6e9 100644 --- a/game-server/app/servers/role/handler/shopHandler.ts +++ b/game-server/app/servers/role/handler/shopHandler.ts @@ -72,13 +72,10 @@ export class ShopHandler { } // 总计可买次数(从配置表读取) - const totalCanBuyTimes = getShopMaxBuyTimes(dicShopItem.price); + const totalCanBuyTimes = dicShopItem.purchaseLimit; if (!totalCanBuyTimes || totalCanBuyTimes <= 0) { return resResult(STATUS.BATTLE_CONSUMES_NOT_ENOUGH); } - - // 最大已买次数 = 总计可买次数 - 本次要买次数 - const maxAlreadyBuyTimes = totalCanBuyTimes - count; // 消耗 let cost = getShopPrice(dicShopItem.money, count, userShop?.count||0, dicShopItem.price); diff --git a/game-server/app/services/shopService.ts b/game-server/app/services/shopService.ts index edcbacae2..4989d4504 100644 --- a/game-server/app/services/shopService.ts +++ b/game-server/app/services/shopService.ts @@ -106,22 +106,6 @@ export function getShopPrice(goodId: number, count: number, buyCount: number, st }] } -/** - * 获取商品的最大购买次数 - * - * @export - * @param {string} str 比如: 1&0|2&50|3&100|4&150|5&200 - */ -export function getShopMaxBuyTimes(str: string) { - let arr = parseShopPrice(str); - for (let { times, maxTimes } of arr) { - if (maxTimes === -1) { - return times; - } - } - return 0; -} - function parseShopPrice(str: string) { let result = new Array<{ times: number, price: number, maxTimes: number }>(); if (!str) return result;