🐞 fix(订单): 各种类型的订单在支付之前校验次数
This commit is contained in:
@@ -153,3 +153,22 @@ export async function makeRefreshShopReward(roleId: string, roleName: string, si
|
||||
data: Object.assign(result, { item: item, activityId: activityId })
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkRefreshShop(roleId: string, serverId: number, activityData: ActivityModelType, productID: string, roundIndex: number) {
|
||||
if (!activityData) return false;
|
||||
if (activityData.type !== ACTIVITY_TYPE.REFRESH_SHOP) return false;
|
||||
let createTime = await getRoleCreateTime(roleId);
|
||||
let serverTime = await getServerCreateTime(serverId);
|
||||
let playerData = new RefreshShopData(activityData, createTime, serverTime);
|
||||
|
||||
if(!roundIndex) {
|
||||
roundIndex = playerData.roundIndex;
|
||||
}
|
||||
let playerRecord: ActivityRefreshShopModelType = await ActivityRefreshShopModel.findData(activityData.activityId, roleId, 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