✨ feat(活动): 月基金每月补发
This commit is contained in:
@@ -44,13 +44,16 @@ export default class Activity_Monthly_Fund extends BaseModel {
|
||||
@prop({ required: true, type: SignRecord, _id: false })
|
||||
record: SignRecord[]; // 铸造记录
|
||||
|
||||
@prop({ required: true })
|
||||
hasReceivedAll: boolean; // 铸造记录
|
||||
|
||||
public static async findData(serverId: number, activityId: number, roundIndex: number, roleId: string) {
|
||||
let result: ActivityMonthlyFundModelType[] = await ActivityMonthlyFundModel.find({ serverId, roleId, activityId, roundIndex }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async buy(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, productID: string) {
|
||||
let result: ActivityMonthlyFundModelType = await ActivityMonthlyFundModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex }, { $setOnInsert: { record: [], productID } }, { new: true, upsert: true }).lean();
|
||||
let result: ActivityMonthlyFundModelType = await ActivityMonthlyFundModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex }, { $setOnInsert: { record: [], productID, hasReceivedAll: false } }, { new: true, upsert: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -58,6 +61,20 @@ export default class Activity_Monthly_Fund extends BaseModel {
|
||||
let result: ActivityMonthlyFundModelType = await ActivityMonthlyFundModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex, 'record.dayIndex': { $ne: dayIndex } }, { $push: { record: new SignRecord(dayIndex, todayIndex)} }, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async setReceivedAll(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number) {
|
||||
let result: ActivityMonthlyFundModelType = await ActivityMonthlyFundModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex }, { $set: { hasReceivedAll: true }}, { new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async findNotReceivedReward(roundIndex: number) {
|
||||
let result: ActivityMonthlyFundModelType[] = await ActivityMonthlyFundModel.find({ roundIndex, hasReceivedAll: false }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async updateHasReceivedAll(_ids: string[]) {
|
||||
await ActivityMonthlyFundModel.updateMany({ _id: { $in: _ids }}, { $set: { hasReceivedAll: true } });
|
||||
}
|
||||
}
|
||||
|
||||
export const ActivityMonthlyFundModel = getModelForClass(Activity_Monthly_Fund);
|
||||
|
||||
Reference in New Issue
Block a user