活动:修复弹出礼包
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();
|
||||
|
||||
@@ -13,6 +13,7 @@ import { CounterModel } from "../../db/Counter";
|
||||
import { calculateCes } from "../playerCeService";
|
||||
import { RoleUpdate } from "../../db/Role";
|
||||
import { sendMessageToUser, sendMessageToUserWithSuc } from "../pushService";
|
||||
import { checkTaskInCreateHero } from "../task/taskService";
|
||||
|
||||
/**
|
||||
* 创建多个武将
|
||||
@@ -77,6 +78,7 @@ import { sendMessageToUser, sendMessageToUserWithSuc } from "../pushService";
|
||||
let goods = await addItems(roleId, roleName, sid, pieces, ITEM_CHANGE_REASON.HERO_TRANSFER_PIECE);
|
||||
resultItems = goods;
|
||||
}
|
||||
await checkTaskInCreateHero(serverId, roleId, sid, resultHeroes.length, resultHeroes);
|
||||
return { heroes: showHeroes, resultHeroes, goods: resultItems }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user