活动:新手限定礼包
This commit is contained in:
@@ -8,7 +8,7 @@ import { index, getModelForClass, prop, DocumentType } from '@typegoose/typegoos
|
||||
|
||||
export default class ActivityFirstGift extends BaseModel {
|
||||
@prop({ required: true })
|
||||
acvitityId: number; // 活动Id
|
||||
activityId: number; // 活动Id
|
||||
@prop({ required: true })
|
||||
roleId: string; // 用户Id
|
||||
@prop({ required: true })
|
||||
@@ -16,27 +16,27 @@ export default class ActivityFirstGift extends BaseModel {
|
||||
|
||||
|
||||
//添加领取记录
|
||||
public static async addRecord(acvitityId: number, roleId: string, index: number) {
|
||||
let result: ActivityFirstGiftModelType = await ActivityFirstGiftModel.findOneAndUpdate({ roleId, acvitityId, },
|
||||
public static async addRecord(activityId: number, roleId: string, index: number) {
|
||||
let result: ActivityFirstGiftModelType = await ActivityFirstGiftModel.findOneAndUpdate({ roleId, activityId, },
|
||||
{ $push: { days: index } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//可以领取首充礼包,充值时间记录
|
||||
public static async begin(acvitityId: number, roleId: string) {
|
||||
let result: ActivityFirstGiftModelType = await ActivityFirstGiftModel.findOneAndUpdate({ roleId, acvitityId },
|
||||
public static async begin(activityId: number, roleId: string) {
|
||||
let result: ActivityFirstGiftModelType = await ActivityFirstGiftModel.findOneAndUpdate({ roleId, activityId },
|
||||
{}, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async findData(acvitityId: number, roleId: string) {
|
||||
let result: ActivityFirstGiftModelType = await ActivityFirstGiftModel.findOne({ roleId, acvitityId }, {}).lean(true);
|
||||
public static async findData(activityId: number, roleId: string) {
|
||||
let result: ActivityFirstGiftModelType = await ActivityFirstGiftModel.findOne({ roleId, activityId }, {}).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//删除活动领取记录
|
||||
public static async deleteActivity(acvitityId: number, roleId: string, roundIndex: number, index: number,) {
|
||||
await ActivityFirstGiftModel.deleteMany({ roleId, acvitityId, index, roundIndex });
|
||||
public static async deleteActivity(activityId: number, roleId: string, roundIndex: number, index: number,) {
|
||||
await ActivityFirstGiftModel.deleteMany({ roleId, activityId, index, roundIndex });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user