|
|
|
|
@@ -569,7 +569,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
for (let task of growthTaskArray) {
|
|
|
|
|
let taskRecord = await ActivityGrowthModel.findDataByCellIndex(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType)
|
|
|
|
|
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null;
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, activity.activityId, parma, recordData);
|
|
|
|
|
if (addCount) {
|
|
|
|
|
if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV) {
|
|
|
|
|
let playerRecord = await ActivityGrowthModel.setTaskCount(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount);
|
|
|
|
|
@@ -595,7 +595,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
for (let task of dailyChallengeTaskArray) {
|
|
|
|
|
let taskRecord = await ActivityDailyChallengesModel.findDataByCellIndex(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType)
|
|
|
|
|
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, activity.activityId, parma, recordData);
|
|
|
|
|
if (addCount) {
|
|
|
|
|
if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV) {
|
|
|
|
|
let playerRecord = await ActivityDailyChallengesModel.setTaskCount(serverId, activity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount);
|
|
|
|
|
@@ -625,7 +625,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
for (let task of taskArray) {
|
|
|
|
|
let taskRecord = await ActivityDailyChallengesModel.findDataByCellIndex(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType)
|
|
|
|
|
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, growthActivity.activityId, parma, recordData);
|
|
|
|
|
if (addCount) {
|
|
|
|
|
if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV) {
|
|
|
|
|
let playerRecord = await ActivityDailyChallengesModel.setTaskCount(serverId, growthActivity.activityId, roleId, task.dayIndex, task.cellIndex, task.taskType, addCount);
|
|
|
|
|
@@ -655,7 +655,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
for (let task of taskArray) {
|
|
|
|
|
let taskRecord = await ActivityRefreshTaskModel.findDataById(serverId, taskActivity.activityId, roleId, taskActivity.roundIndex, task.pageIndex, task.id, task.taskType)
|
|
|
|
|
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, taskActivity.activityId, parma, recordData);
|
|
|
|
|
if (addCount) {
|
|
|
|
|
if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV) {
|
|
|
|
|
let playerRecord = await ActivityRefreshTaskModel.setTaskCount(serverId, taskActivity.activityId, roleId, taskActivity.roundIndex, task.pageIndex, task.id, task.taskType, addCount);
|
|
|
|
|
@@ -695,7 +695,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
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);
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, activity.activityId, parma, recordData);
|
|
|
|
|
if (addCount) {
|
|
|
|
|
let playerRecord = await ActivityTreasureHuntTaskModel.addTreasureHuntTaskCount(serverId, activity.activityId, roleId, huntRoundIndex, task.cellIndex, addCount);
|
|
|
|
|
//推送
|
|
|
|
|
@@ -747,7 +747,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
for (let task of taskArray) {
|
|
|
|
|
let taskRecord = await ActivityThirtyDaysModel.findDataByCellIndex(serverId, thirtyDaysActivity.activityId, roleId, task.pageIndex, task.cellIndex, task.tab, task.taskType)
|
|
|
|
|
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, thirtyDaysActivity.activityId, parma, recordData);
|
|
|
|
|
if (addCount) {
|
|
|
|
|
let playerRecord = await ActivityThirtyDaysModel.addTaskCount(serverId, thirtyDaysActivity.activityId, roleId, task.pageIndex, task.cellIndex, task.tab, task.taskType, addCount);
|
|
|
|
|
//推送
|
|
|
|
|
@@ -787,7 +787,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
} else if (taskType == TASK_TYPE.EQUIP_QUALITY_COUNT || taskType == TASK_TYPE.GACHA_QUALITY_COUNT || taskType == TASK_TYPE.GUILD_ACTIVITY) {//每天统计
|
|
|
|
|
let recordDate = moment(new Date()).startOf('d').toDate()
|
|
|
|
|
let recordData: ActivityPopUpShopRecordModelType = await ActivityPopUpShopRecordModel.findRecordData(serverId, activity.activityId, roleId, task.id, task.taskType, recordDate)
|
|
|
|
|
let { addCount } = isComplete(roleId, task.taskType, task.taskParam, count, parma, null);
|
|
|
|
|
let { addCount } = isComplete(roleId, task.taskType, task.taskParam, count, activity.activityId, parma, null);
|
|
|
|
|
let oldCount = (recordData && recordData.count) ? recordData.count : 0;
|
|
|
|
|
if (oldCount < task.condition && (oldCount + addCount >= task.condition)) {//完成当天任务
|
|
|
|
|
let playerRecord = await ActivityPopUpShopModel.addTaskPushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, oldCount + addCount, beginTime, endTime);
|
|
|
|
|
@@ -812,7 +812,7 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
let taskRecord = await ActivityPopUpShopModel.findDataByTaskId(serverId, activity.activityId, roleId, popShopData.id, popShopData.taskType)
|
|
|
|
|
let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
|
|
|
|
if (!taskRecord || !taskRecord.isPush) {
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, parma, recordData);
|
|
|
|
|
let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, activity.activityId, parma, recordData);
|
|
|
|
|
if (addCount) {
|
|
|
|
|
if (taskType == TASK_TYPE.ROLE_LV || taskType == TASK_TYPE.ROLE_TITLE || taskType == TASK_TYPE.BATTLE_TOWER_LV) {
|
|
|
|
|
let playerRecord = await ActivityPopUpShopModel.setTaskCount(serverId, activity.activityId, roleId, task.id, task.taskType, addCount);
|
|
|
|
|
@@ -903,8 +903,8 @@ export async function accomplishTask(serverId: number, roleId: string, taskType:
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: string, count: number, paramObj?: any, recordData?: any): any {
|
|
|
|
|
console.log('达成任务标准', roleId, taskType, taskParam, count, paramObj)
|
|
|
|
|
export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: string, count: number, activityId: number, paramObj?: any, recordData?: any): any {
|
|
|
|
|
console.log('达成任务标准', roleId, taskType, taskParam, count, activityId, paramObj)
|
|
|
|
|
let param = splitString(taskParam, '&');
|
|
|
|
|
let addCount: number = 0; // 条件是否满足
|
|
|
|
|
let record: any = null;
|
|
|
|
|
@@ -1181,7 +1181,7 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
|
|
|
|
|
}
|
|
|
|
|
case TASK_TYPE.BATTLE_EVENT:
|
|
|
|
|
{
|
|
|
|
|
if (param[0] == paramObj.eventType) {
|
|
|
|
|
if (param[0] == 0 || param[0] == paramObj.eventType) {
|
|
|
|
|
addCount = count;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
@@ -1213,7 +1213,18 @@ export function isComplete(roleId: string, taskType: TASK_TYPE, taskParam: strin
|
|
|
|
|
addCount = count;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case TASK_TYPE.BATTLE_DAILY:
|
|
|
|
|
{
|
|
|
|
|
if (param[0] == 0 || param[0] == paramObj.warId) {
|
|
|
|
|
addCount = count;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case TASK_TYPE.FRIEND_SEND_HEART:
|
|
|
|
|
{
|
|
|
|
|
addCount = count;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
addCount = 0;
|
|
|
|
|
break;
|
|
|
|
|
|