活动:修复弹出礼包
This commit is contained in:
@@ -209,7 +209,11 @@ export async function getTreasureHuntData(serverId: number, roleId: string) {
|
||||
return { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData }
|
||||
}
|
||||
if (now > tempData.huntEndTime) {//活动过期
|
||||
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex } = await getNextActivityData(serverId, roleId, tempData.huntActivityId, tempData.huntEndTime, tempData.huntRoundIndex);
|
||||
let data = await getNextActivityData(serverId, roleId, tempData.huntActivityId, tempData.huntEndTime, tempData.huntRoundIndex);
|
||||
if(!data) {
|
||||
return { activityData: null }
|
||||
}
|
||||
let { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex } = data;
|
||||
if (huntActivityId === 0) {
|
||||
return { huntActivityId, huntBeginTime, huntEndTime, huntRoundIndex, activityData }
|
||||
}
|
||||
@@ -278,6 +282,9 @@ async function getNextActivityData(serverId: number, roleId: string, oldHuntActi
|
||||
let curDate = moment(new Date()).toDate()
|
||||
|
||||
let index = treasureHuntDataArray.findIndex(obj => { return obj && obj.activityId === oldHuntActivityId });
|
||||
if(index == -1) {
|
||||
return null
|
||||
}
|
||||
for (; index < treasureHuntDataArray.length; index++) {
|
||||
let data = treasureHuntDataArray[index];
|
||||
let endTime = moment(huntBeginTime).add(data.day, 'd').toDate();
|
||||
|
||||
Reference in New Issue
Block a user