diff --git a/game-server/app/servers/role/handler/shopHandler.ts b/game-server/app/servers/role/handler/shopHandler.ts index cf154bd3a..aaea014c7 100644 --- a/game-server/app/servers/role/handler/shopHandler.ts +++ b/game-server/app/servers/role/handler/shopHandler.ts @@ -9,6 +9,7 @@ import { HeroModel } from "../../../db/Hero"; import { checkShopInPurchase, getShopDicById, getShopListByType, getShopPrice } from "../../../services/shopService"; import { RewardInter } from "../../../pubUtils/interface"; import { UserShopTypeModel } from "../../../db/UserShopType"; +import { nowSeconds } from "../../../pubUtils/timeUtil"; export default function(app: Application) { return new ShopHandler(app); @@ -58,6 +59,8 @@ export class ShopHandler { let dicShopItem = await getShopDicById(activityId, shopItemId, roleId, serverId); if(!dicShopItem) return resResult(STATUS.DIC_DATA_NOT_FOUND); if(dicShopItem['productID'] && dicShopItem['productID'] != '&') return resResult(STATUS.CAN_NOT_PURCHASE); + if(dicShopItem['beginTime'] && dicShopItem['beginTime'] > nowSeconds()) return resResult(STATUS.SHOP_CLOSED); + if(dicShopItem['endTime'] && dicShopItem['endTime'] < nowSeconds()) return resResult(STATUS.SHOP_CLOSED); let userShop = await UserShopModel.findByRoleAndItem(roleId, activityId, dicShopItem, seasonNum); diff --git a/shared/consts/statusCode.ts b/shared/consts/statusCode.ts index 4a7d12520..a8f912cda 100644 --- a/shared/consts/statusCode.ts +++ b/shared/consts/statusCode.ts @@ -427,6 +427,7 @@ export const STATUS = { LV_LIMIT: { code: 30905, simStr: '玩家等级不足' }, CAN_NOT_PURCHASE: { code: 30906, simStr: '该商品不可使用该购买方式' }, LADDER_LV_LIMIT: { code: 30907, simStr: '名将擂台等级不足' }, + SHOP_TIME_OUT: { code: 30908, simStr: '该商品不可购买' }, // 任务相关 31001-31100 TASK_NOT_REACH_CONDITION: { code: 31001, simStr: '任务不满足条件' }, @@ -502,7 +503,7 @@ export const STATUS = { MONOPOLY_BANK_COUNT_ERROR: { code: 50031, simStr: '数量错误' }, MONOPOLY_BANK_SAVE_MAX: { code: 50032, simStr: '超过最大限制数量' }, NOT_GIFTPACKAGE: { code: 50033, simStr: '非礼包类型' }, - SHOP_CLOSED: { code: 50034, simStr: '停业' }, + SHOP_CLOSED: { code: 50034, simStr: '商品不可购买' }, ACTIVITY_RECHARGE_ITEM_NOT_ENOUGH: { code: 50035, simStr: '商品不足' }, ACTIVITY_ITEM_CANNOT_RECEIVE: { code: 50036, simStr: '无可领取物品' }, ACTIVITY_POP_UP_MUST_BUY: { code: 50037, simStr: '该礼包必须购买' },