寻宝:信息边窗

This commit is contained in:
luying
2022-07-07 13:27:43 +08:00
parent b1dc091453
commit 460d0d6955
15 changed files with 153 additions and 38 deletions
+13 -4
View File
@@ -15,7 +15,7 @@ import { getFriendList, getApplyList } from './friendService';
import { getDailyBattleList } from './dailyBattleService';
import { getExpeditionStatus } from './expeditionService';
import { getTowerStatus, getHungupRewards, getTasks } from './battleService';
import { getAllAssistCnt } from './comBattleService';
import { getAllAssistCnt, getComBtlLvByPlayerLv } from './comBattleService';
import { getDungeonData } from './dungeonService';
import { PvpSeasonResultModel } from '../db/PvpSeasonResult';
import { nowSeconds, getZeroPoint } from '../pubUtils/timeUtil';
@@ -44,6 +44,7 @@ import { HeroParam } from '../domain/roleField/hero';
import { pick } from 'underscore';
import { sendMessageToAllWithSuc, sendMessageToServerWithSuc, sendMessageToUser, sendMessageToUserWithSuc } from './pushService';
import { getSurvey } from './gmService';
import { ComBattleTeamModel } from '../db/ComBattleTeam';
/**
* init: 初始的时候是否推送 true-推 false-不推
@@ -146,9 +147,7 @@ export async function getModuleData(type: string, data: { role: RoleType, sessio
case 'tower': // 镇念塔
return await getTowerEntryData(role);
case 'comBattle': // 寻宝
const assistCnt = await getAllAssistCnt(roleId);
const blueprts = await Item.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
return { assistCnt, blueprts }
return await getComBattleEntryData(role);
case 'dungeon': // 秘境
return await getDungeonData(role);
case 'pvp': // pvp
@@ -289,6 +288,16 @@ async function getGuildEntryData(role: RoleType, sid: string, session: FrontendO
return { hasGuild: false }
}
async function getComBattleEntryData(role: RoleType) {
let { roleId, lv, topLineupCe } = role;
const assistCnt = await getAllAssistCnt(roleId);
const blueprts = await Item.findByRoleAndType(roleId, CONSUME_TYPE.BLUEPRT);
let { minLv, maxLv } = getComBtlLvByPlayerLv(lv);
let refreshTime = nowSeconds() - 60;
const invitations = await ComBattleTeamModel.findInvitations(roleId, minLv, maxLv, topLineupCe, refreshTime, 1);
return { assistCnt, blueprts, hasInvitation: invitations.length > 0, invitationTime: invitations.length > 0?invitations[0].inviteTime: 0 }
}
export async function pushRefreshTime() {
let todayZeroPoint = getZeroPoint();
await sendMessageToAllWithSuc(PUSH_ROUTE.REFRESH_TIME, { todayZeroPoint });