🐞 fix(商店): 限制限时商店超时不可购买
This commit is contained in:
@@ -9,6 +9,7 @@ import { HeroModel } from "../../../db/Hero";
|
|||||||
import { checkShopInPurchase, getShopDicById, getShopListByType, getShopPrice } from "../../../services/shopService";
|
import { checkShopInPurchase, getShopDicById, getShopListByType, getShopPrice } from "../../../services/shopService";
|
||||||
import { RewardInter } from "../../../pubUtils/interface";
|
import { RewardInter } from "../../../pubUtils/interface";
|
||||||
import { UserShopTypeModel } from "../../../db/UserShopType";
|
import { UserShopTypeModel } from "../../../db/UserShopType";
|
||||||
|
import { nowSeconds } from "../../../pubUtils/timeUtil";
|
||||||
|
|
||||||
export default function(app: Application) {
|
export default function(app: Application) {
|
||||||
return new ShopHandler(app);
|
return new ShopHandler(app);
|
||||||
@@ -58,6 +59,8 @@ export class ShopHandler {
|
|||||||
let dicShopItem = await getShopDicById(activityId, shopItemId, roleId, serverId);
|
let dicShopItem = await getShopDicById(activityId, shopItemId, roleId, serverId);
|
||||||
if(!dicShopItem) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
if(!dicShopItem) return resResult(STATUS.DIC_DATA_NOT_FOUND);
|
||||||
if(dicShopItem['productID'] && dicShopItem['productID'] != '&') return resResult(STATUS.CAN_NOT_PURCHASE);
|
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);
|
let userShop = await UserShopModel.findByRoleAndItem(roleId, activityId, dicShopItem, seasonNum);
|
||||||
|
|
||||||
|
|||||||
@@ -427,6 +427,7 @@ export const STATUS = {
|
|||||||
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: '名将擂台等级不足' },
|
LADDER_LV_LIMIT: { code: 30907, simStr: '名将擂台等级不足' },
|
||||||
|
SHOP_TIME_OUT: { code: 30908, simStr: '该商品不可购买' },
|
||||||
|
|
||||||
// 任务相关 31001-31100
|
// 任务相关 31001-31100
|
||||||
TASK_NOT_REACH_CONDITION: { code: 31001, simStr: '任务不满足条件' },
|
TASK_NOT_REACH_CONDITION: { code: 31001, simStr: '任务不满足条件' },
|
||||||
@@ -502,7 +503,7 @@ export const STATUS = {
|
|||||||
MONOPOLY_BANK_COUNT_ERROR: { code: 50031, simStr: '数量错误' },
|
MONOPOLY_BANK_COUNT_ERROR: { code: 50031, simStr: '数量错误' },
|
||||||
MONOPOLY_BANK_SAVE_MAX: { code: 50032, simStr: '超过最大限制数量' },
|
MONOPOLY_BANK_SAVE_MAX: { code: 50032, simStr: '超过最大限制数量' },
|
||||||
NOT_GIFTPACKAGE: { code: 50033, 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_RECHARGE_ITEM_NOT_ENOUGH: { code: 50035, simStr: '商品不足' },
|
||||||
ACTIVITY_ITEM_CANNOT_RECEIVE: { code: 50036, simStr: '无可领取物品' },
|
ACTIVITY_ITEM_CANNOT_RECEIVE: { code: 50036, simStr: '无可领取物品' },
|
||||||
ACTIVITY_POP_UP_MUST_BUY: { code: 50037, simStr: '该礼包必须购买' },
|
ACTIVITY_POP_UP_MUST_BUY: { code: 50037, simStr: '该礼包必须购买' },
|
||||||
|
|||||||
Reference in New Issue
Block a user