活动:成长活动、今日挑战奖励接口返回数据添加字段
This commit is contained in:
+19
-19
@@ -27,62 +27,62 @@ export default class ActivityGrowth extends BaseModel {
|
||||
getPointReward: boolean; // 是否兑换领取奖章奖励
|
||||
|
||||
//任务领取记录
|
||||
public static async addCellRecord(activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, count: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ roleId, activityId, dayIndex, cellIndex, type },
|
||||
{ $inc: { receiveRewardCount: count } }, { upsert: true, new: true }).lean(lean);
|
||||
public static async addCellRecord(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, count: number, addPointCount: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex, type },
|
||||
{ $inc: { receiveRewardCount: count, addPointCount: addPointCount } }, { upsert: true, new: true }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//当日奖章领取记录
|
||||
public static async addDayRecord(activityId: number, roleId: string, dayIndex: number, cellIndex: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ roleId, activityId, dayIndex, cellIndex },
|
||||
public static async addDayRecord(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $set: { getPointReward: true } }, { upsert: true, new: true }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async setTaskCount(activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, count: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ roleId, activityId, dayIndex, cellIndex, type },
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, count: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex, type },
|
||||
{ $set: { totalCount: count } }, { upsert: true, new: true }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async addTaskCount(activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, addCount: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ roleId, activityId, dayIndex, cellIndex, type },
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, addCount: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex, type },
|
||||
{ $inc: { totalCount: addCount } }, { upsert: true, new: true }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动id查询活动数据
|
||||
public static async findData(activityId: number, roleId: string, lean = true) {
|
||||
let result: ActivityGrowthModelType[] = await ActivityGrowthModel.find({ roleId, activityId }).lean(lean);
|
||||
public static async findData(serverId: number, activityId: number, roleId: string, lean = true) {
|
||||
let result: ActivityGrowthModelType[] = await ActivityGrowthModel.find({ serverId, roleId, activityId }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//查询第几天的活动数据
|
||||
public static async findDataByDayIndex(activityId: number, roleId: string, dayIndex: number, lean = true) {
|
||||
let result: ActivityGrowthModelType[] = await ActivityGrowthModel.find({ roleId, activityId, dayIndex }).lean(lean);
|
||||
public static async findDataByDayIndex(serverId: number, activityId: number, roleId: string, dayIndex: number, lean = true) {
|
||||
let result: ActivityGrowthModelType[] = await ActivityGrowthModel.find({ serverId, roleId, activityId, dayIndex }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//查询第几天某个的活动数据
|
||||
public static async findDataByCellIndex(activityId: number, roleId: string, dayIndex: number, cellIndex: number, lean = true) {
|
||||
let result: ActivityGrowthModelType[] = await ActivityGrowthModel.find({ roleId, activityId, dayIndex, cellIndex }).lean(lean);
|
||||
public static async findDataByCellIndex(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, lean = true) {
|
||||
let result: ActivityGrowthModelType[] = await ActivityGrowthModel.find({ serverId, roleId, activityId, dayIndex, cellIndex }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//新增领取记录
|
||||
public static async addData(activityId: number, roleId: string, dayIndex: number, cellIndex: number, count: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ roleId, activityId, dayIndex, cellIndex },
|
||||
public static async addData(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, count: number, lean = true) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $: { count: count } },
|
||||
{ upsert: true, new: true }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
//删除活动领取记录
|
||||
public static async deleteActivity(activityId: number, roleId: string, dayIndex: number, cellIndex: number) {
|
||||
await ActivityGrowthModel.deleteMany({ roleId, activityId, dayIndex, cellIndex });
|
||||
public static async deleteActivity(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number) {
|
||||
await ActivityGrowthModel.deleteMany({ serverId, roleId, activityId, dayIndex, cellIndex });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user