活动:节日活动添加每日关卡
This commit is contained in:
@@ -653,30 +653,32 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
||||
let huntEndTime = tempData.huntEndTime;
|
||||
let huntRoundIndex = tempData.huntRoundIndex;
|
||||
let activity = await ActivityModel.findActivity(tempData.huntActivityId);
|
||||
let playerData = new TreasureHuntData(activity);
|
||||
playerData.beginTime = moment(huntBeginTime).valueOf();
|
||||
playerData.endTime = moment(huntEndTime).valueOf();
|
||||
playerData.roundIndex = huntRoundIndex;
|
||||
let taskArray = playerData.tasks.findItemByTaskType(taskType);
|
||||
for (let task of taskArray) {
|
||||
let taskRecord: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findDataByCellIndex(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex);
|
||||
if (!taskRecord || !taskRecord.isPush) {
|
||||
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
||||
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
||||
if (addCount) {
|
||||
let playerRecord = await ActivityTreasureHuntTaskModel.addTreasureHuntTaskCount(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex, addCount);
|
||||
//推送
|
||||
if (task.condition <= playerRecord.totalCount) {//已经完成
|
||||
playerRecord = await ActivityTreasureHuntTaskModel.pushMessage(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex);
|
||||
task.totalCount = playerRecord.totalCount;
|
||||
pushMessage = pushMessage.concat(Object.assign(task, { activityId: activity.activityId }));
|
||||
} else {//没有完成
|
||||
task.totalCount = playerRecord.totalCount;
|
||||
pushMessage = pushMessage.concat(Object.assign(task, { activityId: activity.activityId }));
|
||||
if (activity) {
|
||||
let playerData = new TreasureHuntData(activity);
|
||||
playerData.beginTime = moment(huntBeginTime).valueOf();
|
||||
playerData.endTime = moment(huntEndTime).valueOf();
|
||||
playerData.roundIndex = huntRoundIndex;
|
||||
let taskArray = playerData.tasks.findItemByTaskType(taskType);
|
||||
for (let task of taskArray) {
|
||||
let taskRecord: ActivityTreasureHuntTaskModelType = await ActivityTreasureHuntTaskModel.findDataByCellIndex(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex);
|
||||
if (!taskRecord || !taskRecord.isPush) {
|
||||
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
||||
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
||||
if (addCount) {
|
||||
let playerRecord = await ActivityTreasureHuntTaskModel.addTreasureHuntTaskCount(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex, addCount);
|
||||
//推送
|
||||
if (task.condition <= playerRecord.totalCount) {//已经完成
|
||||
playerRecord = await ActivityTreasureHuntTaskModel.pushMessage(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex);
|
||||
task.totalCount = playerRecord.totalCount;
|
||||
pushMessage = pushMessage.concat(Object.assign(task, { activityId: activity.activityId }));
|
||||
} else {//没有完成
|
||||
task.totalCount = playerRecord.totalCount;
|
||||
pushMessage = pushMessage.concat(Object.assign(task, { activityId: activity.activityId }));
|
||||
}
|
||||
}
|
||||
if (record) {
|
||||
await ActivityTreasureHuntTaskModel.addTreasureHuntTaskRecord(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex, JSON.stringify(record));
|
||||
}
|
||||
}
|
||||
if (record) {
|
||||
await ActivityTreasureHuntTaskModel.addTreasureHuntTaskRecord(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex, JSON.stringify(record));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user