活动:修复问题
This commit is contained in:
@@ -65,7 +65,7 @@ export class DailyChallengesHandler {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
}
|
||||
|
||||
await ActivityDailyChallengesModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, type, 1);
|
||||
await ActivityDailyChallengesModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, 1);
|
||||
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(dailyItemData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, rewardParamArr, ITEM_CHANGE_REASON.DAILY_CHALLENGE_REWARD)
|
||||
|
||||
@@ -66,7 +66,7 @@ export class GrowthHandler {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
}
|
||||
|
||||
await ActivityGrowthModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, type, 1);
|
||||
await ActivityGrowthModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, 1);
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(growthItemData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, rewardParamArr, ITEM_CHANGE_REASON.GROWTH_REWARD)
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ export class RefreshTaskHandler {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
}
|
||||
|
||||
await ActivityRefreshTaskModel.addReceiveRecord(serverId, activityId, roleId, roundIndex, pageIndex, id, type, 1);
|
||||
await ActivityRefreshTaskModel.addReceiveRecord(serverId, activityId, roleId, roundIndex, pageIndex, id, 1);
|
||||
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(dailyItemData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, rewardParamArr, ITEM_CHANGE_REASON.REFRESH_TASK_REWARD)
|
||||
|
||||
@@ -70,7 +70,7 @@ export class SevenDaysHandler {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
}
|
||||
|
||||
await ActivityGrowthModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, type, 1);
|
||||
await ActivityGrowthModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, 1);
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(growthItemData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, rewardParamArr, ITEM_CHANGE_REASON.GROWTH_REWARD)
|
||||
|
||||
@@ -152,7 +152,7 @@ export class SevenDaysHandler {
|
||||
return resResult(STATUS.ACTIVITY_REWARDED);
|
||||
}
|
||||
|
||||
await ActivityDailyChallengesModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, type, 1);
|
||||
await ActivityDailyChallengesModel.addCellRecord(serverId, activityId, roleId, dayIndex, cellIndex, 1);
|
||||
|
||||
let rewardParamArr: Array<RewardParam> = stringToRewardParam(dailyItemData.reward);
|
||||
let result = await addReward(roleId, roleName, sid, serverId, rewardParamArr, ITEM_CHANGE_REASON.DAILY_CHALLENGE_REWARD)
|
||||
|
||||
@@ -168,7 +168,7 @@ export class CheckSingleTask {
|
||||
let dicTaskTypeDesc = gameData.taskDescByType.get(taskType);
|
||||
|
||||
// 检查一般任务
|
||||
let dicTasks = gameData.taskType.get(taskType);
|
||||
let dicTasks = gameData.taskType.get(taskType)||[];
|
||||
let groups = new Map<string, { type: number, group: string, taskParam: number[], taskIds: number[] }>(); // 以group做区分
|
||||
for (let { id, type, group, taskParam } of dicTasks) {
|
||||
if (!groups.has(`${type}_${group}`)) {
|
||||
@@ -213,7 +213,7 @@ export class CheckSingleTask {
|
||||
return data? data.records: []
|
||||
});
|
||||
if(taskUpdateParam) {
|
||||
let rec = await ActivityGrowthModel.setOrIncTask(serverId, activityId, roleId, task.dayIndex, task.cellIndex, taskUpdateParam);
|
||||
let rec = await ActivityGrowthModel.setOrIncTask(serverId, activityId, roleId, task.dayIndex, task.cellIndex, taskType, taskUpdateParam);
|
||||
if(!rec) continue;
|
||||
this.addActivityTaskPushMessage({...task, totalCount: rec.totalCount, receiveRewardCount: rec.receiveRewardCount||0, activityId, activityType: "growth" });
|
||||
}
|
||||
@@ -229,7 +229,7 @@ export class CheckSingleTask {
|
||||
return data? data.records: []
|
||||
});
|
||||
if(taskUpdateParam) {
|
||||
let rec = await ActivityDailyChallengesModel.setOrIncTask(serverId, activityId, roleId, task.dayIndex, task.cellIndex, taskUpdateParam);
|
||||
let rec = await ActivityDailyChallengesModel.setOrIncTask(serverId, activityId, roleId, task.dayIndex, task.cellIndex, taskType, taskUpdateParam);
|
||||
if(!rec) continue;
|
||||
this.addActivityTaskPushMessage({...task, totalCount: rec.totalCount, receiveRewardCount: rec.receiveRewardCount||0, activityId, activityType: "daily" });
|
||||
}
|
||||
@@ -247,7 +247,7 @@ export class CheckSingleTask {
|
||||
return data? data.records: []
|
||||
});
|
||||
if(taskUpdateParam) {
|
||||
let rec = await ActivityRefreshTaskModel.setOrIncTask(serverId, activityId, roleId, taskActivity.roundIndex, task.pageIndex, task.id, taskUpdateParam);
|
||||
let rec = await ActivityRefreshTaskModel.setOrIncTask(serverId, activityId, roleId, taskActivity.roundIndex, task.pageIndex, task.id, taskType, taskUpdateParam);
|
||||
if(!rec) continue;
|
||||
this.addActivityTaskPushMessage({...task, totalCount: rec.totalCount, receiveRewardCount: rec.receiveRewardCount||0, activityId });
|
||||
}
|
||||
@@ -267,7 +267,7 @@ export class CheckSingleTask {
|
||||
return data? data.records: [];
|
||||
});
|
||||
if(taskUpdateParam) {
|
||||
let rec = await ActivityTreasureHuntTaskModel.setOrIncTask(serverId, activityId, roleId, tempData.huntRoundIndex, task.cellIndex, taskUpdateParam);
|
||||
let rec = await ActivityTreasureHuntTaskModel.setOrIncTask(serverId, activityId, roleId, tempData.huntRoundIndex, task.cellIndex, taskType, taskUpdateParam);
|
||||
if(!rec) continue;
|
||||
this.addActivityTaskPushMessage({ ...task, totalCount: rec.totalCount, activityId });
|
||||
}
|
||||
@@ -286,7 +286,7 @@ export class CheckSingleTask {
|
||||
return data? data.records: [];
|
||||
});
|
||||
if(taskUpdateParam) {
|
||||
let rec = await ActivityThirtyDaysModel.setOrIncTask(serverId, thirtyDaysActivity.activityId, roleId, task.pageIndex, task.cellIndex, task.tab, taskUpdateParam);
|
||||
let rec = await ActivityThirtyDaysModel.setOrIncTask(serverId, thirtyDaysActivity.activityId, roleId, task.pageIndex, task.cellIndex, task.tab, taskType, taskUpdateParam);
|
||||
if(!rec) continue;
|
||||
this.addActivityTaskPushMessage({ ...task, totalCount: rec.totalCount, activityId });
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class Activity_Daily_Challenges extends BaseModel {
|
||||
@prop({ required: true })
|
||||
cellIndex: number; // 第几天的第几个奖励
|
||||
@prop({ required: true })
|
||||
type: number; // 任务类型
|
||||
taskType: number; // 任务类型
|
||||
@prop({ required: true })
|
||||
totalCount: number; // 累计达成次数
|
||||
@prop({ required: true })
|
||||
@@ -30,32 +30,32 @@ export default class Activity_Daily_Challenges extends BaseModel {
|
||||
records: string[]; // 数据信息
|
||||
|
||||
//任务领取记录
|
||||
public static async addCellRecord(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, count: number, lean = true) {
|
||||
let result: ActivityDailyChallengesModelType = await ActivityDailyChallengesModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex, type },
|
||||
public static async addCellRecord(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, count: number, lean = true) {
|
||||
let result: ActivityDailyChallengesModelType = await ActivityDailyChallengesModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $inc: { receiveRewardCount: count } }, { upsert: true, new: true }).lean(lean);
|
||||
return result;
|
||||
}
|
||||
|
||||
// 更新任务
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, param: UpdateTaskParam) {
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, taskType: number, param: UpdateTaskParam) {
|
||||
if(param.set) {
|
||||
return await this.setTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, param.set, param.records);
|
||||
return await this.setTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, taskType, param.set, param.records);
|
||||
} else if (param.inc) {
|
||||
return await this.addTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, param.inc, param.records);
|
||||
return await this.addTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, taskType, param.inc, param.records);
|
||||
}
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, count: number, records?: string[]) {
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityDailyChallengesModelType = await ActivityDailyChallengesModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $set: { totalCount: count, records } }, { upsert: true, new: true }).lean();
|
||||
{ $set: { totalCount: count, records, taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, addCount: number, records?: string[]) {
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, taskType: number, addCount: number, records?: string[]) {
|
||||
let result: ActivityDailyChallengesModelType = await ActivityDailyChallengesModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $inc: { totalCount: addCount }, $set: { records: records||[]} }, { upsert: true, new: true }).lean();
|
||||
{ $inc: { totalCount: addCount }, $set: { records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ export default class Activity_Growth extends BaseModel {
|
||||
@prop({ required: true })
|
||||
cellIndex: number; // 第几天的第几个奖励
|
||||
@prop({ required: true })
|
||||
type: number; // 任务类型
|
||||
taskType: number; // 任务类型
|
||||
@prop({ required: true })
|
||||
totalCount: number; // 累计达成次数
|
||||
@prop({ required: true })
|
||||
@@ -30,31 +30,31 @@ export default class Activity_Growth extends BaseModel {
|
||||
records: string[]; // 数据信息
|
||||
|
||||
//任务领取记录
|
||||
public static async addCellRecord(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, type: number, count: number,) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex, type },
|
||||
public static async addCellRecord(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, count: number,) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $inc: { receiveRewardCount: count } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, param: UpdateTaskParam) {
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, taskType: number, param: UpdateTaskParam) {
|
||||
if(param.set) {
|
||||
return await this.setTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, param.set, param.records);
|
||||
return await this.setTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, taskType, param.set, param.records);
|
||||
} else if (param.inc) {
|
||||
return await this.addTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, param.inc, param.records);
|
||||
return await this.addTaskCount(serverId, activityId, roleId, dayIndex, cellIndex, taskType, param.inc, param.records);
|
||||
}
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, count: number, records?: string[]) {
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $set: { totalCount: count, records: records||[] } }, { upsert: true, new: true }).lean();
|
||||
{ $set: { totalCount: count, records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, addCount: number, records?: string[]) {
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, dayIndex: number, cellIndex: number, taskType: number, addCount: number, records?: string[]) {
|
||||
let result: ActivityGrowthModelType = await ActivityGrowthModel.findOneAndUpdate({ serverId, roleId, activityId, dayIndex, cellIndex },
|
||||
{ $inc: { totalCount: addCount }, $set: { records: records||[] } }, { upsert: true, new: true }).lean();
|
||||
{ $inc: { totalCount: addCount }, $set: { records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class Activity_Refresh_Task extends BaseModel {
|
||||
@prop({ required: true })
|
||||
id: number; // id
|
||||
@prop({ required: true })
|
||||
type: number; // 任务类型
|
||||
taskType: number; // 任务类型
|
||||
@prop({ required: true })
|
||||
totalCount: number; // 累计达成次数
|
||||
@prop({ required: true })
|
||||
@@ -32,41 +32,34 @@ export default class Activity_Refresh_Task extends BaseModel {
|
||||
records: string[]; // 数据信息
|
||||
|
||||
//任务领取记录
|
||||
public static async addReceiveRecord(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, type: number, count: number) {
|
||||
let result: ActivityRefreshTaskModelType = await ActivityRefreshTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex, id, type },
|
||||
public static async addReceiveRecord(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, count: number) {
|
||||
let result: ActivityRefreshTaskModelType = await ActivityRefreshTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex, id },
|
||||
{ $inc: { receiveRewardCount: count } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// 更新任务
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, param: UpdateTaskParam) {
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, taskType: number, param: UpdateTaskParam) {
|
||||
if(param.set) {
|
||||
return await this.setTaskCount(serverId, activityId, roleId, roundIndex, pageIndex, id, param.set, param.records);
|
||||
return await this.setTaskCount(serverId, activityId, roleId, roundIndex, pageIndex, id, taskType, param.set, param.records);
|
||||
} else if (param.inc) {
|
||||
return await this.addTaskCount(serverId, activityId, roleId, roundIndex, pageIndex, id, param.inc, param.records);
|
||||
return await this.addTaskCount(serverId, activityId, roleId, roundIndex, pageIndex, id, taskType, param.inc, param.records);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, count: number, records?: string[]) {
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityRefreshTaskModelType = await ActivityRefreshTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex, id },
|
||||
{ $set: { totalCount: count, records: records||[] }}, { upsert: true, new: true }).lean();
|
||||
{ $set: { totalCount: count, records: records||[], taskType }}, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, count: number, records?: string[]) {
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityRefreshTaskModelType = await ActivityRefreshTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex, id },
|
||||
{ $inc: { totalCount: count }, $set: { records: records||[] } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动记录统计数据
|
||||
public static async addTaskRecord(serverId: number, activityId: number, roleId: string, roundIndex: number, pageIndex: number, id: number, type: number, data: string,) {
|
||||
let result: ActivityRefreshTaskModelType = await ActivityRefreshTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, pageIndex, id, type },
|
||||
{ $set: { data: data } }, { upsert: true, new: true }).lean(true);
|
||||
{ $inc: { totalCount: count }, $set: { records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ export default class Activity_Thirty_Days extends BaseModel {
|
||||
@prop({ required: true })
|
||||
tab: number; // 具体任务id
|
||||
@prop({ required: true })
|
||||
type: number; // 任务类型
|
||||
taskType: number; // 任务类型
|
||||
@prop({ required: true })
|
||||
totalCount: number; // 累计达成次数
|
||||
@prop({ required: true })
|
||||
@@ -38,20 +38,6 @@ export default class Activity_Thirty_Days extends BaseModel {
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动记录统计数据
|
||||
public static async addTaskRecord(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, type: number, data: string,) {
|
||||
let result: ActivityThirtyDaysModelType = await ActivityThirtyDaysModel.findOneAndUpdate({ serverId, roleId, activityId, pageIndex, cellIndex, tab, type },
|
||||
{ $set: { data: data } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//推送标记
|
||||
public static async pushMessage(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, type: number) {
|
||||
let result: ActivityThirtyDaysModelType = await ActivityThirtyDaysModel.findOneAndUpdate({ serverId, roleId, activityId, pageIndex, cellIndex, tab, type },
|
||||
{ $set: { isPush: true, } }, { upsert: true, new: true }).lean(true);
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动id查询活动数据
|
||||
public static async findData(serverId: number, activityId: number, roleId: string, lean = true) {
|
||||
let result: ActivityThirtyDaysModelType[] = await ActivityThirtyDaysModel.find({ serverId, roleId, activityId }).lean(lean);
|
||||
@@ -66,11 +52,11 @@ export default class Activity_Thirty_Days extends BaseModel {
|
||||
|
||||
|
||||
// 更新任务
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, param: UpdateTaskParam) {
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, taskType: number, param: UpdateTaskParam) {
|
||||
if(param.set) {
|
||||
return await this.setTaskCount(serverId, activityId, roleId, pageIndex, cellIndex, tab, param.set, param.records);
|
||||
return await this.setTaskCount(serverId, activityId, roleId, pageIndex, cellIndex, tab, taskType, param.set, param.records);
|
||||
} else if (param.inc) {
|
||||
return await this.addTaskCount(serverId, activityId, roleId, pageIndex, cellIndex, tab, param.inc, param.records);
|
||||
return await this.addTaskCount(serverId, activityId, roleId, pageIndex, cellIndex, tab, taskType, param.inc, param.records);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,16 +69,16 @@ export default class Activity_Thirty_Days extends BaseModel {
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, count: number, records?: string[]) {
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityThirtyDaysModelType = await ActivityThirtyDaysModel.findOneAndUpdate({ serverId, roleId, activityId, pageIndex, cellIndex, tab },
|
||||
{ $inc: { totalCount: count }, $set: { records: records||[] } }, { upsert: true, new: true }).lean();
|
||||
{ $inc: { totalCount: count }, $set: { records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, count: number, records?: string[]) {
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, pageIndex: number, cellIndex: number, tab: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityThirtyDaysModelType = await ActivityThirtyDaysModel.findOneAndUpdate({ serverId, roleId, activityId, pageIndex, cellIndex, tab },
|
||||
{ $set: { totalCount: count, records: records||[] } }, { upsert: true, new: true }).lean();
|
||||
{ $set: { totalCount: count, records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,25 +29,25 @@ export default class Activity_Treasure_Hunt_Task extends ActivityGrowth {
|
||||
}
|
||||
|
||||
// 更新任务
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, param: UpdateTaskParam) {
|
||||
public static async setOrIncTask(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, taskType: number, param: UpdateTaskParam) {
|
||||
if(param.set) {
|
||||
return await this.setTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, param.set, param.records);
|
||||
return await this.setTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, taskType, param.set, param.records);
|
||||
} else if (param.inc) {
|
||||
return await this.addTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, param.inc, param.records);
|
||||
return await this.addTaskCount(serverId, activityId, roleId, roundIndex, cellIndex, taskType, param.inc, param.records);
|
||||
}
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, count: number, records?: string[]) {
|
||||
public static async setTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex },
|
||||
{ $set: { totalCount: count, records: records||[] } }, { upsert: true, new: true }).lean();
|
||||
{ $set: { totalCount: count, records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据活动统计完成任务次数
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, count: number, records?: string[]) {
|
||||
public static async addTaskCount(serverId: number, activityId: number, roleId: string, roundIndex: number, cellIndex: number, taskType: number, count: number, records?: string[]) {
|
||||
let result: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findOneAndUpdate({ serverId, roleId, activityId, roundIndex, cellIndex },
|
||||
{ $inc: { totalCount: count }, $set: { records: records||[] } }, { upsert: true, new: true }).lean();
|
||||
{ $inc: { totalCount: count }, $set: { records: records||[], taskType } }, { upsert: true, new: true }).lean();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import { TASK_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityRefreshTaskModelType } from '../../db/ActivityRefreshTask';
|
||||
import { ActivityRefreshTaskPointModelType } from '../../db/ActivityRefreshTaskPoint';
|
||||
import { parseNumberList } from '../../pubUtils/util';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
|
||||
@@ -17,6 +18,7 @@ export class RefreshTaskItem {
|
||||
skip: number; //跳转客户端用
|
||||
point: number; //奖励的点数
|
||||
|
||||
taskParamArray: number[] = [];
|
||||
totalCount: number = 0; //完成任务累计次数
|
||||
receiveRewardCount: number = 0; //领取奖励次数
|
||||
|
||||
@@ -32,6 +34,7 @@ export class RefreshTaskItem {
|
||||
this.point = data.point;
|
||||
this.totalCount = 0;
|
||||
this.receiveRewardCount = 0;
|
||||
this.taskParamArray = parseNumberList(data.taskParam);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,10 +81,10 @@ export class RefreshTaskData extends ActivityBase {
|
||||
}
|
||||
|
||||
public findTaskByType(type: TASK_TYPE) {
|
||||
let arr = [];
|
||||
let arr: RefreshTaskItem[] = [];
|
||||
for (let pageData of this.list) {
|
||||
let items = pageData.items.filter(item => { return item.taskType == type });
|
||||
arr = arr.concat(items)
|
||||
arr.push(...items);
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
@@ -90,7 +93,7 @@ export class RefreshTaskData extends ActivityBase {
|
||||
public setPlayerRecords(data: ActivityRefreshTaskModelType[], pointRecordData: ActivityRefreshTaskPointModelType) {
|
||||
for (let pageData of this.list) {
|
||||
for (let item of pageData.items) {
|
||||
let index = data.findIndex(record => { return item.id == record.id && item.pageIndex == record.pageIndex && item.taskType == record.type })
|
||||
let index = data.findIndex(record => { return item.id == record.id && item.pageIndex == record.pageIndex && item.taskType == record.taskType })
|
||||
if (index != -1) {
|
||||
item.totalCount = data[index].totalCount ? data[index].totalCount : 0;
|
||||
item.receiveRewardCount = data[index].receiveRewardCount ? data[index].receiveRewardCount : 0;
|
||||
|
||||
@@ -18,7 +18,7 @@ export class SevenDaysDailyItem {
|
||||
name: string; // 任务名称
|
||||
taskType: number; // 任务类型 dic_zyz_taskType.json
|
||||
taskParam: string; //任务数据 dic_zyz_taskType.json
|
||||
taskParamArray: number[];
|
||||
taskParamArray: number[] = [];
|
||||
condition: number; //任务数据条件 dic_zyz_taskType.jsonT
|
||||
reward: string; // 任务奖励,格式:1&3&1(类型&id&数量) 类型定义:1.英雄,2.物品
|
||||
skip: string; // 跳转
|
||||
|
||||
@@ -119,7 +119,7 @@ export class ThirtyDaysData extends ActivityBase {
|
||||
totalPoint: number = 0;//总共点数
|
||||
|
||||
public findTaskByType(type: number) {
|
||||
let task = [];
|
||||
let task: ThirtyDaysItem[] = [];
|
||||
for (let i = 0; i < this.list.length; i++) {
|
||||
let items = this.list[i].item;
|
||||
for (let itemData of items) {
|
||||
|
||||
Reference in New Issue
Block a user