活动:寻宝骑兵领取奖励接口
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
import moment = require('moment');
|
||||
import { ACTIVITY_TYPE, SERVER_OPEN_TIME, TASK_TYPE } from '../consts';
|
||||
import { ACTIVITY_TYPE, SERVER_OPEN_TIME } from '../consts';
|
||||
import { ActivityModel, ActivityModelType } from '../db/Activity';
|
||||
import { ActivityTreasureHuntShopModel, ActivityTreasureHuntShopModelType } from '../db/ActivityTreasureHuntShop';
|
||||
import { ActivityTreasureHuntTaskModel, ActivityTreasureHuntTaskModelType } from '../db/ActivityTreasureHuntTask';
|
||||
import { ActivityTreasureHuntTreasureShopModel, ActivityTreasureHuntTreasureShopModelType } from '../db/ActivityTreasureHuntTreasureShop';
|
||||
import { ServerlistModel } from '../db/Serverlist';
|
||||
import { ServerTempModel, ServerTempModelType } from '../db/ServerTemp';
|
||||
import { RewardParam } from '../domain/activityField/rewardField';
|
||||
import { TreasureHuntData } from '../domain/activityField/treasureHuntField';
|
||||
import { deltaDays } from '../pubUtils/util';
|
||||
import { addReward, stringToRewardParam } from './giftPackageService';
|
||||
|
||||
/**
|
||||
* 获取活动数据
|
||||
@@ -45,7 +45,12 @@ export async function getPlayerTreasureHuntData(activityId: number, serverId: nu
|
||||
playerData.roundIndex = huntRoundIndex;
|
||||
|
||||
let playerShopRecord: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findTreasureData(activityId, roleId, huntRoundIndex, playerData.todayIndex);
|
||||
playerData.shop.setPlayerRecords(playerShopRecord);
|
||||
playerData.shop.setPlayerShopRecords(playerShopRecord);
|
||||
let playerTaskRecord: ActivityTreasureHuntTaskModelType[] = await ActivityTreasureHuntTaskModel.findDataByRoundIndex(serverId, activityId, roleId, huntRoundIndex);
|
||||
playerData.tasks.setPlayerTaskRecords(playerTaskRecord);
|
||||
let playerTreasureShopRecord: ActivityTreasureHuntTreasureShopModelType = await ActivityTreasureHuntTreasureShopModel.findData(activityId, roleId, huntRoundIndex);
|
||||
playerData.treasureShop.setPlayerTreasureShopRecords(playerTreasureShopRecord);
|
||||
|
||||
return playerData;
|
||||
}
|
||||
|
||||
@@ -59,7 +64,47 @@ export async function getPlayerTreasureHuntShopData(activityId: number, serverId
|
||||
playerData.roundIndex = huntRoundIndex;
|
||||
|
||||
let playerShopRecord: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findTreasureData(activityId, roleId, huntRoundIndex, playerData.todayIndex);
|
||||
playerData.shop.setPlayerRecords(playerShopRecord);
|
||||
playerData.shop.setPlayerShopRecords(playerShopRecord);
|
||||
return playerData;
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntTaskData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
|
||||
let playerData = new TreasureHuntData(activityData);
|
||||
playerData.beginTime = moment(huntBeginTime).valueOf();
|
||||
playerData.endTime = moment(huntEndTime).valueOf();
|
||||
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
|
||||
playerData.roundIndex = huntRoundIndex;
|
||||
|
||||
let playerTaskRecord: ActivityTreasureHuntTaskModelType[] = await ActivityTreasureHuntTaskModel.findDataByRoundIndex(serverId, activityId, roleId, huntRoundIndex);
|
||||
playerData.tasks.setPlayerTaskRecords(playerTaskRecord);
|
||||
return playerData;
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntChallengeData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
|
||||
let playerData = new TreasureHuntData(activityData);
|
||||
playerData.beginTime = moment(huntBeginTime).valueOf();
|
||||
playerData.endTime = moment(huntEndTime).valueOf();
|
||||
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
|
||||
playerData.roundIndex = huntRoundIndex;
|
||||
|
||||
return playerData;
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntTreasureShopData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
|
||||
let playerData = new TreasureHuntData(activityData);
|
||||
playerData.beginTime = moment(huntBeginTime).valueOf();
|
||||
playerData.endTime = moment(huntEndTime).valueOf();
|
||||
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
|
||||
playerData.roundIndex = huntRoundIndex;
|
||||
|
||||
let playerTreasureShopRecord: ActivityTreasureHuntTreasureShopModelType = await ActivityTreasureHuntTreasureShopModel.findData(activityId, roleId, huntRoundIndex);
|
||||
playerData.treasureShop.setPlayerTreasureShopRecords(playerTreasureShopRecord);
|
||||
return playerData;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user