🐞 fix(充值): 限购礼包限制充值次数
This commit is contained in:
@@ -140,3 +140,18 @@ export async function makeLimitPackageReward(roleId: string, roleName: string, s
|
||||
data: Object.assign(result, { item: item, activityId: activityId })
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkLimitPackageCanBuy(roleId: string, serverId: number, activityData: ActivityModelType, productID: string) {
|
||||
if(!activityData) return false
|
||||
let createTime = await getRoleCreateTime(roleId);
|
||||
let serverTime = await getServerCreateTime(serverId);
|
||||
let playerData = new LimitShopData(activityData, createTime, serverTime);
|
||||
|
||||
let playerRecord: ActivityShopModelType = await ActivityShopModel.findData(activityData.activityId, roleId, playerData.roundIndex);
|
||||
playerData.setPlayerRecords(playerRecord);
|
||||
|
||||
let item = playerData.findItemByProductID(productID);
|
||||
if (!item) return false
|
||||
if (item.countMax > 0 && item.buyCount >= item.countMax) return false;
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user