diff --git a/game-server/app/servers/activity/handler/activityMonopolyHandler.ts b/game-server/app/servers/activity/handler/activityMonopolyHandler.ts index fdc13f847..fe409cf0f 100644 --- a/game-server/app/servers/activity/handler/activityMonopolyHandler.ts +++ b/game-server/app/servers/activity/handler/activityMonopolyHandler.ts @@ -240,7 +240,7 @@ export class ActivityMonopolyHandler { let rewardArray = stringToRewardParam(item.reward) let result = await addReward(roleId, roleName, sid, serverId, rewardArray, ITEM_CHANGE_REASON.MONOPOLY_BUY_GOODS); - await ActivityRefreshShopModel.addRecord(shopActivityId, roleId, roundIndex, pageIndex, id); + await ActivityRefreshShopModel.addRecord(shopActivityId, roleId, roundIndex, pageIndex, id, 1); item.buyCount += 1; return resResult(STATUS.SUCCESS, Object.assign(result, { diff --git a/game-server/app/services/activity/refreshShopService.ts b/game-server/app/services/activity/refreshShopService.ts index c0effa4c7..47125849d 100644 --- a/game-server/app/services/activity/refreshShopService.ts +++ b/game-server/app/services/activity/refreshShopService.ts @@ -145,7 +145,7 @@ export async function makeRefreshShopReward(roleId: string, roleName: string, si let rewardArray = stringToRewardParam(item.reward) let result = await addReward(roleId, roleName, sid, serverId, rewardArray, ITEM_CHANGE_REASON.BUY_REFRESH_SHOP); - await ActivityRefreshShopModel.addRecord(activityId, roleId, playerData.roundIndex, item.pageIndex, item.id); + await ActivityRefreshShopModel.addRecord(activityId, roleId, playerData.roundIndex, item.pageIndex, item.id, 1); item.buyCount += 1; return { diff --git a/shared/db/ActivityRefreshShop.ts b/shared/db/ActivityRefreshShop.ts index e648a231a..b04e2a863 100644 --- a/shared/db/ActivityRefreshShop.ts +++ b/shared/db/ActivityRefreshShop.ts @@ -45,9 +45,13 @@ export default class Activity_Refresh_Shop extends BaseModel { goods: GoodsInfo[]; // 可购买商品 //购买领取奖励的记录 - public static async addRecord(activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number) { + public static async addRecord(activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, count: number) { + let records = []; + for(let i = 0; i < count; i++) { + records.push({ id, pageIndex, time: new Date() }); + } let result: ActivityRefreshShopModelType = await ActivityRefreshShopModel.findOneAndUpdate({ roleId, activityId, roundIndex }, - { $push: { records: { pageIndex, id, time: new Date() } } }, { upsert: true, new: true }).lean(true); + { $push: { records: { $each: records } } }, { upsert: true, new: true }).lean(true); return result; }