🐞 fix(订单): 各种类型的订单在支付之前校验次数
This commit is contained in:
@@ -40,6 +40,10 @@ export default class Activity_Buy_Records extends BaseModel {
|
||||
public static async deleteActivity(activityId: number, roleId: string, pageIndex: number, cellIndex: number) {
|
||||
await ActivityBuyRecordsModel.deleteMany({ roleId, activityId, pageIndex, cellIndex });
|
||||
}
|
||||
|
||||
public static async checkRecord(activityId: number, roleId: string, type: number, pageIndex: number) {
|
||||
return await ActivityBuyRecordsModel.exists({ roleId, activityId, type, pageIndex });
|
||||
}
|
||||
}
|
||||
|
||||
export const ActivityBuyRecordsModel = getModelForClass(Activity_Buy_Records);
|
||||
|
||||
@@ -73,6 +73,16 @@ export default class Activity_Daily_RMB_Gifts extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 检查是否购买过
|
||||
public static async checkHasBought(serverId: number, activityId: number, roleId: string, beginTime: Date, todayIndex: number) {
|
||||
return await ActivityDailyRMBGiftsModel.exists({ serverId, roleId, activityId, beginTime, todayIndex });
|
||||
}
|
||||
|
||||
public static async checkHasReceive(serverId: number, activityId: number, roleId: string, beginTime: Date, todayIndex: number, id: number) {
|
||||
return await ActivityDailyRMBGiftsModel.exists({ serverId, roleId, activityId, beginTime, todayIndex, 'records.id': id });
|
||||
}
|
||||
|
||||
//删除活动领取记录
|
||||
public static async deleteActivity(serverId: number, activityId: number, roleId: string) {
|
||||
await ActivityDailyRMBGiftsModel.deleteMany({ serverId, roleId, activityId });
|
||||
|
||||
@@ -41,6 +41,10 @@ export default class Activity_Monthly_Ticket extends BaseModel {
|
||||
public static async buyMonthlyTicket(serverId: number, roleId: string, activityId: number, activityType: number, endTime: Date, isForever: boolean) {
|
||||
await ActivityMonthlyTicketModel.findOneAndUpdate({ serverId, roleId, activityId, activityType }, { $set: { endTime, dayIndex: 0, isForever } }, { upsert: true, new: true }).lean();
|
||||
}
|
||||
|
||||
public static async checkHasBought(serverId: number, roleId: string, activityId: number, activityType: number,) {
|
||||
return await ActivityMonthlyTicketModel.exists({ serverId, roleId, activityId, activityType, endTime: { $gt: new Date() } });
|
||||
}
|
||||
}
|
||||
|
||||
export const ActivityMonthlyTicketModel = getModelForClass(Activity_Monthly_Ticket);
|
||||
|
||||
@@ -62,6 +62,11 @@ export default class Activity_Task_Pass extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 是否买过
|
||||
public static async check(serverId: number, activityId: number, roleId: string, roundIndex: number, productID: string) {
|
||||
return await ActivityTaskPassModel.exists({ serverId, roleId, activityId, roundIndex, productIDs: productID });
|
||||
}
|
||||
|
||||
public static async receiveItems(serverId: number, activityId: number, roleId: string, roundIndex: number, receivedReward: ReceivedReward[]) {
|
||||
// console.log(receivedReward)
|
||||
let result: ActivityTaskPassModelType = await ActivityTaskPassModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex},
|
||||
|
||||
Reference in New Issue
Block a user