🐞 fix(活动): 修复活动商店记录bug

This commit is contained in:
luying
2022-11-21 15:07:43 +08:00
parent ff10ff4c7d
commit 4e8d785bea
3 changed files with 8 additions and 4 deletions

View File

@@ -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;
}