活动:寻宝骑兵添加首页奖励内容

This commit is contained in:
qiaoxin
2021-06-03 15:55:40 +08:00
parent b628f0704a
commit fff8ef153d
7 changed files with 176 additions and 139 deletions

View File

@@ -4,6 +4,7 @@ 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 { ActivityTreasureHuntFirstPageModel, ActivityTreasureHuntFirstPageModelType } from '../db/ActivityTreasureHuntFirstPage';
import { ServerlistModel } from '../db/Serverlist';
import { ServerTempModel, ServerTempModelType } from '../db/ServerTemp';
import { TreasureHuntData } from '../domain/activityField/treasureHuntField';
@@ -44,6 +45,8 @@ export async function getPlayerTreasureHuntData(activityId: number, serverId: nu
playerData.todayIndex = deltaDays(moment(huntBeginTime).startOf('d').toDate(), new Date) + 1;;
playerData.roundIndex = huntRoundIndex;
let playerTreasureFirstPageecord: ActivityTreasureHuntFirstPageModelType = await ActivityTreasureHuntFirstPageModel.findData(serverId, activityId, roleId, huntRoundIndex);
playerData.firstPage.setPlayerFirstPageRecord(playerTreasureFirstPageecord);
let playerShopRecord: ActivityTreasureHuntShopModelType = await ActivityTreasureHuntShopModel.findTreasureData(activityId, roleId, huntRoundIndex, playerData.todayIndex);
playerData.shop.setPlayerShopRecords(playerShopRecord);
let playerTaskRecord: ActivityTreasureHuntTaskModelType[] = await ActivityTreasureHuntTaskModel.findDataByRoundIndex(serverId, activityId, roleId, huntRoundIndex);
@@ -54,6 +57,20 @@ export async function getPlayerTreasureHuntData(activityId: number, serverId: nu
return playerData;
}
export async function getPlayerTreasureHuntFirstPageData(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 playerTreasureFirstPageecord: ActivityTreasureHuntFirstPageModelType = await ActivityTreasureHuntFirstPageModel.findData(serverId, activityId, roleId, huntRoundIndex);
playerData.firstPage.setPlayerFirstPageRecord(playerTreasureFirstPageecord);
return playerData;
}
export async function getPlayerTreasureHuntShopData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);