商店:添加vip购买次数上限
This commit is contained in:
@@ -40,6 +40,7 @@ export class ShopHandler {
|
||||
let sid = session.get('sid');
|
||||
let guildCode = session.get('guildCode');
|
||||
let serverId = session.get('serverId');
|
||||
let vipStartTime: number = session.get('vipStartTime');
|
||||
|
||||
let { shopItemId, count } = msg;
|
||||
if( count < 0) return resResult(STATUS.WRONG_PARMS);
|
||||
@@ -65,8 +66,14 @@ export class ShopHandler {
|
||||
|
||||
let userShop = await UserShopModel.findByRoleAndItem(roleId, dicShopItem.id);
|
||||
if(dicShopItem.purchaseLimit != -1) {
|
||||
if(userShop && userShop.count + count > dicShopItem.purchaseLimit) {
|
||||
return resResult(STATUS.BUY_COUNT_OVER);
|
||||
if(vipStartTime > 0 && dicShopItem.purchaseLimit != -1) {
|
||||
if(userShop && userShop.count + count > dicShopItem.purchaseLimit + dicShopItem.vipPurchaseLimit) {
|
||||
return resResult(STATUS.BUY_COUNT_OVER);
|
||||
}
|
||||
} else {
|
||||
if(userShop && userShop.count + count > dicShopItem.purchaseLimit) {
|
||||
return resResult(STATUS.BUY_COUNT_OVER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user