🎈 perf(活动): 神州探秘购买添加次数参数
This commit is contained in:
@@ -30,9 +30,13 @@ export default class Activity_Shop extends BaseModel {
|
||||
records: BuyRecord[]; // 购买记录
|
||||
|
||||
//购买领取奖励的记录
|
||||
public static async addRecord(activityId: number, roleId: string, roundIndex: number, id: number) {
|
||||
public static async addRecord(activityId: number, roleId: string, roundIndex: number, id: number, count: number) {
|
||||
let records = [];
|
||||
for(let i = 0; i < count; i++) {
|
||||
records.push({ id, time: new Date() });
|
||||
}
|
||||
let result: ActivityShopModelType = await ActivityShopModel.findOneAndUpdate({ roleId, activityId, roundIndex },
|
||||
{ $push: { records: { id, time: new Date() } } }, { upsert: true, new: true }).lean(true);
|
||||
{ $push: { records: { $each: records } } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,9 +20,13 @@ export default class Activity_Treasure_Hunt_Shop extends ActivityShop {
|
||||
}
|
||||
|
||||
//购买领取奖励的记录
|
||||
public static async buyShopRecord(activityId: number, roleId: string, roundIndex: number, dayIndex: number, id: number) {
|
||||
public static async buyShopRecord(activityId: number, roleId: string, roundIndex: number, dayIndex: number, id: number, count: number) {
|
||||
let records = [];
|
||||
for(let i = 0; i < count; i++) {
|
||||
records.push({ id, time: new Date() });
|
||||
}
|
||||
let result: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findOneAndUpdate({ roleId, activityId, roundIndex, dayIndex },
|
||||
{ $push: { records: { 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