活动:30天任务支持多次重复购买
This commit is contained in:
@@ -76,8 +76,8 @@ export class PopUpShopHandler {
|
||||
if (!playerRecords) {
|
||||
return resResult(STATUS.ACTIVITY_POP_UP_SHOP_EXPIRE);
|
||||
}
|
||||
if (playerRecords.isBuy) {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
if (playerRecords.buyCount >= playerData.count) {
|
||||
return resResult(STATUS.ACTIVITY_MAX_COUNT);
|
||||
}
|
||||
|
||||
if (playerData.condition > playerRecords.totalCount) {
|
||||
@@ -96,7 +96,9 @@ export class PopUpShopHandler {
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(playerData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr)
|
||||
|
||||
playerData.isBuy = true;
|
||||
await ActivityPopUpShopModel.addRecord(serverId, activityId, roleId, id, playerData.taskType, 1);
|
||||
|
||||
playerData.buyCount += 1;
|
||||
return resResult(STATUS.SUCCESS, Object.assign(result, {
|
||||
param: { activityId, id },
|
||||
item: playerData
|
||||
|
||||
@@ -42,13 +42,12 @@ export async function getPlayerPopUpShopData(activityId: number, serverId: numbe
|
||||
let allPlayerShop = [];
|
||||
let allTaskData = JSON.parse(activityData.data);
|
||||
for (let record of playerRecords) {
|
||||
if (!record.isBuy) {//没有购买
|
||||
if (record.isPush) {//没有购买
|
||||
let index = allTaskData.findIndex(obj => { return obj && obj.id === record.id && obj.taskType === record.type })
|
||||
if (index != -1) {
|
||||
let playerData = new PopUpShopData(allTaskData[index], activityData.activityId);
|
||||
playerData.isBuy == false;
|
||||
playerData.setPlayerRecords(record)
|
||||
if (playerData.condition <= record.totalCount) {
|
||||
if (playerData.buyCount < allTaskData[index].count) {
|
||||
allPlayerShop.push(playerData)
|
||||
}
|
||||
}
|
||||
@@ -92,16 +91,16 @@ export async function makePopUpShopReward(roleId: string, roleName: string, sid:
|
||||
if (playerRecord.totalCount < playerData.condition) {
|
||||
return STATUS.ACTIVITY_TASK_UNCOMPLETED;
|
||||
}
|
||||
if (!playerRecord.isBuy) {
|
||||
if (playerRecord.buyCount >= playerData.count) {
|
||||
return STATUS.ACTIVITY_REWARDED;
|
||||
}
|
||||
playerRecord = await ActivityPopUpShopModel.addRecord(serverId, activityId, roleId, playerData.id, playerData.taskType);
|
||||
playerRecord = await ActivityPopUpShopModel.addRecord(serverId, activityId, roleId, playerData.id, playerData.taskType, 1);
|
||||
playerData.setPlayerRecords(playerRecord);
|
||||
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(playerData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, funcs, rewardParamArr)
|
||||
|
||||
playerData.isBuy = true;
|
||||
|
||||
return {
|
||||
code: 0,
|
||||
data: Object.assign(result, { item: playerData, activityId: activityData.activityId })
|
||||
|
||||
Reference in New Issue
Block a user