活动存入内存中
This commit is contained in:
@@ -12,6 +12,7 @@ import { deltaDays } from '../../pubUtils/util';
|
||||
import { addReward, stringToRewardParam } from './giftPackageService';
|
||||
import { RewardParam } from '../../domain/activityField/rewardField';
|
||||
import { RoleModel } from '../../db/Role';
|
||||
import { getActivityById } from './activityService';
|
||||
|
||||
/**
|
||||
* 获取活动数据
|
||||
@@ -84,7 +85,7 @@ export async function treasureHuntTaskActivity(serverId: number, roleId: string)
|
||||
*
|
||||
*/
|
||||
export async function getPlayerTreasureHuntData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
let activityData = await getActivityById(activityId);
|
||||
|
||||
let { createTime } = await RoleModel.findByRoleId(roleId);
|
||||
let playerData = new TreasureHuntData(activityData, createTime);
|
||||
@@ -106,7 +107,7 @@ export async function getPlayerTreasureHuntData(activityId: number, serverId: nu
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntFirstPageData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
let activityData: ActivityModelType = await getActivityById(activityId);
|
||||
|
||||
let { createTime } = await RoleModel.findByRoleId(roleId);
|
||||
let playerData = new TreasureHuntData(activityData, createTime);
|
||||
@@ -121,7 +122,7 @@ export async function getPlayerTreasureHuntFirstPageData(activityId: number, ser
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntShopData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
let activityData: ActivityModelType = await getActivityById(activityId);
|
||||
|
||||
let { createTime } = await RoleModel.findByRoleId(roleId);
|
||||
let playerData = new TreasureHuntData(activityData, createTime);
|
||||
@@ -136,7 +137,7 @@ export async function getPlayerTreasureHuntShopData(activityId: number, serverId
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntTaskData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
let activityData: ActivityModelType = await getActivityById(activityId);
|
||||
|
||||
let { createTime } = await RoleModel.findByRoleId(roleId);
|
||||
let playerData = new TreasureHuntData(activityData, createTime);
|
||||
@@ -151,7 +152,7 @@ export async function getPlayerTreasureHuntTaskData(activityId: number, serverId
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntChallengeData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
let activityData: ActivityModelType = await getActivityById(activityId);
|
||||
|
||||
let { createTime } = await RoleModel.findByRoleId(roleId);
|
||||
let playerData = new TreasureHuntData(activityData, createTime);
|
||||
@@ -164,7 +165,7 @@ export async function getPlayerTreasureHuntChallengeData(activityId: number, ser
|
||||
}
|
||||
|
||||
export async function getPlayerTreasureHuntTreasureShopData(activityId: number, serverId: number, roleId: string, huntRoundIndex: number, huntBeginTime: Date, huntEndTime: Date) {
|
||||
let activityData: ActivityModelType = await ActivityModel.findActivity(activityId);
|
||||
let activityData: ActivityModelType = await getActivityById(activityId);
|
||||
|
||||
let { createTime } = await RoleModel.findByRoleId(roleId);
|
||||
let playerData = new TreasureHuntData(activityData, createTime);
|
||||
@@ -190,7 +191,7 @@ export async function getTreasureHuntData(serverId: number, roleId: string) {
|
||||
return { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData }
|
||||
}
|
||||
tempData = await ServerTempModel.updateTreasureHuntData(serverId, huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex);
|
||||
activityData = await ActivityModel.findActivity(huntActivityId);
|
||||
activityData = await getActivityById(huntActivityId);
|
||||
return { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData }
|
||||
}
|
||||
if (now > tempData.huntEndTime) {//活动过期
|
||||
@@ -199,11 +200,11 @@ export async function getTreasureHuntData(serverId: number, roleId: string) {
|
||||
return { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData }
|
||||
}
|
||||
tempData = await ServerTempModel.updateTreasureHuntData(serverId, huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex);
|
||||
activityData = await ActivityModel.findActivity(huntActivityId);
|
||||
activityData = await getActivityById(huntActivityId);
|
||||
return { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData }
|
||||
}
|
||||
if (!activityData) {
|
||||
activityData = await ActivityModel.findActivity(tempData.huntActivityId);
|
||||
activityData = await getActivityById(tempData.huntActivityId);
|
||||
}
|
||||
return {
|
||||
huntActivityId: tempData.huntActivityId,
|
||||
|
||||
Reference in New Issue
Block a user