活动:首冲活动添加查询是否结束相关逻辑
This commit is contained in:
@@ -29,8 +29,8 @@ export default class Activity extends BaseModel {
|
||||
}
|
||||
|
||||
//根据活动类型查询活动数据
|
||||
public static async findActivityByType(serverId: number, type: number, lean = true) {
|
||||
let result: ActivityModelType[] = await ActivityModel.find({ serverId, type }).lean(lean);
|
||||
public static async findActivityByType(serverId: number, type: number, sort: number) {
|
||||
let result: ActivityModelType[] = await ActivityModel.find({ serverId, type }).sort({ activityId: sort }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,12 +13,13 @@ export default class ActivityFirstGift extends BaseModel {
|
||||
roleId: string; // 用户Id
|
||||
@prop({ required: true })
|
||||
days: Array<number>; // 领取过的奖励
|
||||
|
||||
@prop({ required: true })
|
||||
isOver: boolean; // 是否全部领取结束
|
||||
|
||||
//添加领取记录
|
||||
public static async addRecord(activityId: number, roleId: string, indexArray: number[]) {
|
||||
public static async addRecord(activityId: number, roleId: string, indexArray: number[], isOver: boolean) {
|
||||
let result: ActivityFirstGiftModelType = await ActivityFirstGiftModel.findOneAndUpdate({ roleId, activityId, },
|
||||
{ $push: { days: { $each: indexArray } } }, { upsert: true, new: true }).lean(true);
|
||||
{ $push: { days: { $each: indexArray } }, $set: { isOver: isOver } }, { new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user