活动:添加弹出礼包每日弹出的逻辑
This commit is contained in:
@@ -5,6 +5,7 @@ import { RewardParam } from '../domain/activityField/rewardField';
|
||||
import { addReward, stringToRewardParam } from './giftPackageService';
|
||||
import { ActivityPopUpShopModel, ActivityPopUpShopModelType } from '../db/ActivityPopUpShop';
|
||||
import { ServerlistModel } from '../db/Serverlist';
|
||||
import moment = require('moment');
|
||||
|
||||
/**
|
||||
* 获取活动数据
|
||||
@@ -56,6 +57,76 @@ export async function getPlayerPopUpShopData(activityId: number, serverId: numbe
|
||||
return allPlayerShop;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * 弹出礼包任务特殊处理
|
||||
// *
|
||||
// * @param {number} serverId 区Id
|
||||
// * @param {number} activityId 活动Id
|
||||
// * @param {string} roleId 角色Id
|
||||
// *
|
||||
// */
|
||||
// export async function checkPopUpActivityTask(serverId: number, sid: number, funcs: number[], roleId: string, taskType: number, addCount: number) {
|
||||
// let { activityGroupId } = await ServerlistModel.findByServerId(serverId);
|
||||
// let allActivity = await ActivityModel.findOpenActivityByType(activityGroupId, ACTIVITY_TYPE.POP_UP_SHOP, new Date());
|
||||
// for (let activity of allActivity) {
|
||||
// let allTaskData: any[] = JSON.parse(activity.data);
|
||||
// for (let task of allTaskData) {
|
||||
// if (task.taskType == taskType) {
|
||||
// let popShopData = new PopUpShopData(task, activity.activityId);
|
||||
// let taskRecord = await ActivityPopUpShopModel.findDataByTaskId(serverId, activity.activityId, roleId, popShopData.id, popShopData.taskType)
|
||||
// let recordData = taskRecord && taskRecord.data ? JSON.parse(taskRecord.data) : null
|
||||
|
||||
// let beginTime = new Date();
|
||||
// let endTime = moment(new Date()).add(task.duration, 'h').toDate();
|
||||
// if (taskType == TASK_TYPE.ROLE_TERAPH_STAGE_UP) {//只要触发就弹出礼包商店
|
||||
// //推送
|
||||
// let playerRecord = await ActivityPopUpShopModel.addTaskPushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, addCount, beginTime, endTime);
|
||||
// popShopData.setPlayerRecords(playerRecord)
|
||||
// // pushMessage = pushMessage.concat(popShopData);
|
||||
// } else if (taskType == TASK_TYPE.EQUIP_QUALITY_COUNT || taskType == TASK_TYPE.GACHA_QUALITY_COUNT) {//每天统计
|
||||
|
||||
// }
|
||||
|
||||
// // if (!taskRecord || !taskRecord.isPush) {
|
||||
// // let { addCount, record } = isComplete(roleId, task.taskType, task.taskParam, count, 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);
|
||||
// // //推送
|
||||
// // if (task.condition <= playerRecord.totalCount) {
|
||||
// // playerRecord = await ActivityPopUpShopModel.pushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, beginTime, endTime);
|
||||
// // popShopData.setPlayerRecords(playerRecord)
|
||||
// // pushMessage = pushMessage.concat(popShopData);
|
||||
// // }
|
||||
// // } else if (taskType == TASK_TYPE.ROLE_TERAPH_STAGE_UP) {//只要触发就弹出礼包商店
|
||||
// // //推送
|
||||
// // let playerRecord = await ActivityPopUpShopModel.addTaskPushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, addCount, beginTime, endTime);
|
||||
// // popShopData.setPlayerRecords(playerRecord)
|
||||
// // pushMessage = pushMessage.concat(popShopData);
|
||||
// // } else if (taskType == TASK_TYPE.EQUIP_QUALITY_COUNT || taskType == TASK_TYPE.GACHA_QUALITY_COUNT) {//每天统计
|
||||
|
||||
// // } else {
|
||||
// // let playerRecord = await ActivityPopUpShopModel.addTaskCount(serverId, activity.activityId, roleId, task.id, task.taskType, addCount);
|
||||
// // //推送
|
||||
// // if (task.condition <= playerRecord.totalCount) {
|
||||
// // playerRecord = await ActivityPopUpShopModel.pushMessage(serverId, activity.activityId, roleId, task.id, task.taskType, beginTime, endTime);
|
||||
// // popShopData.setPlayerRecords(playerRecord)
|
||||
// // pushMessage = pushMessage.concat(popShopData);
|
||||
// // }
|
||||
// // }
|
||||
// // }
|
||||
// // if (record) {
|
||||
// // await ActivityPopUpShopModel.addTaskRecord(serverId, activity.activityId, roleId, task.id, task.taskType, JSON.stringify(record));
|
||||
// // }
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 结算购买礼包的奖励
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user