活动:招财进宝宝箱5点未领取发放邮箱
This commit is contained in:
@@ -25,20 +25,25 @@ export default class Activity_Daily_Coin extends BaseModel {
|
||||
@prop({ required: true })
|
||||
roundIndex: number; // 周期数
|
||||
@prop({ required: true, type: Number })
|
||||
receivedBox: number[]; // 周期数
|
||||
receivedBox: number[]; // 已领取宝箱
|
||||
|
||||
@prop({ required: true })
|
||||
hasNotReceivedBox: boolean; // 是否有没有领取的宝箱
|
||||
|
||||
@prop({ required: true })
|
||||
repaireBoxed: number[]; // 是否有没有领取的宝箱
|
||||
|
||||
//兑换记录
|
||||
public static async addExchangeRecord(serverId: number, activityId: number, roleId: string, roundIndex: number, count: number, coinCount: number, msg: string) {
|
||||
public static async addExchangeRecord(serverId: number, activityId: number, roleId: string, roundIndex: number, count: number, coinCount: number, msg: string, hasNotReceivedBox: boolean) {
|
||||
let result = await ActivityDailyCoinModel.findOneAndUpdate({ serverId, activityId, roleId, roundIndex },
|
||||
{ $inc: { exchangeCount: count, coinCount: coinCount }, $push: { recordMsg: msg } }, { upsert: true, new: true }).lean(true)
|
||||
{ $inc: { exchangeCount: count, coinCount: coinCount }, $push: { recordMsg: msg }, $set: { hasNotReceivedBox } }, { upsert: true, new: true }).lean(true)
|
||||
return result;
|
||||
}
|
||||
|
||||
// 领取宝箱
|
||||
public static async receiveBox(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number) {
|
||||
public static async receiveBox(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, hasNotReceivedBox: boolean) {
|
||||
let result = await ActivityDailyCoinModel.findOneAndUpdate({ serverId, activityId, roleId, roundIndex },
|
||||
{ $push: { receivedBox: cellIndex } }, { upsert: true, new: true }).lean(true)
|
||||
{ $push: { receivedBox: cellIndex }, $set: { hasNotReceivedBox } }, { upsert: true, new: true }).lean(true)
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -50,6 +55,21 @@ export default class Activity_Daily_Coin extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 未发放完
|
||||
public static async findUnreceivedBox(beginTime: Date, endTime: Date) {
|
||||
let result: ActivityDailyCoinModelType[] = await ActivityDailyCoinModel.find({
|
||||
createdAt: { $gte: beginTime, $lte: endTime }, hasNotReceivedBox: true
|
||||
}).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 凌晨5点补发邮箱
|
||||
public static async repaireBox(_id: string, boxIds: number[]) {
|
||||
let result = await ActivityDailyCoinModel.findByIdAndUpdate({ _id },
|
||||
{ $push: { repaireBoxed: { $each: boxIds } } }, { upsert: true, new: true }).lean(true)
|
||||
return result;
|
||||
}
|
||||
|
||||
//删除活动兑换记录
|
||||
public static async deleteActivity(serverId: number, activityId: number, roleId: string, roundIndex: number) {
|
||||
await ActivityDailyCoinModel.deleteMany({ serverId, roleId, activityId, roundIndex });
|
||||
|
||||
Reference in New Issue
Block a user