🐞 fix(活动): 修复活动商店记录bug
This commit is contained in:
@@ -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, {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user