pvp:首页推送

This commit is contained in:
luying
2021-11-02 20:02:44 +08:00
parent cb3583276c
commit 8afe9150f2
5 changed files with 18 additions and 8 deletions
@@ -4,6 +4,7 @@ import { resResult } from '../../../pubUtils/util';
import { reloadResources } from '../../../pubUtils/data'; import { reloadResources } from '../../../pubUtils/data';
import { UserGuildType } from '../../../db/UserGuild'; import { UserGuildType } from '../../../db/UserGuild';
import { kickUser } from '../../../services/connectorService'; import { kickUser } from '../../../services/connectorService';
import { PVPConfigType } from '../../../db/SystemConfig';
export default function (app: Application) { export default function (app: Application) {
new HandlerService(app, {}); new HandlerService(app, {});
return new ConnectorRemote(app); return new ConnectorRemote(app);
@@ -51,4 +52,11 @@ export class ConnectorRemote {
public getServerMainten() { public getServerMainten() {
return this.maintenServers; return this.maintenServers;
} }
public setPvpSeasonNum(pvpConfig: PVPConfigType) {
if(pvpConfig) {
this.app.set('pvpSeasonNum', pvpConfig.seasonNum);
this.app.set('pvpSeasonEndTime', pvpConfig.seasonEndTime);
}
}
} }
+7 -4
View File
@@ -36,6 +36,7 @@ import { getAllOnlineRoles } from './redisService';
import Item from '../db/Item'; import Item from '../db/Item';
import { PvpDefenseModel } from '../db/PvpDefense'; import { PvpDefenseModel } from '../db/PvpDefense';
import { getDonation } from './donateService'; import { getDonation } from './donateService';
import { refChallengeCnt } from './pvpService';
export async function pushData(role: RoleType, session: FrontendOrBackendSession, pushType: 'entry' | 'refresh' = 'entry') { export async function pushData(role: RoleType, session: FrontendOrBackendSession, pushType: 'entry' | 'refresh' = 'entry') {
try { try {
@@ -188,12 +189,14 @@ async function getTowerEntryData(role: RoleType) {
* @param roleId * @param roleId
*/ */
async function getPvpEntryData(roleId: string) { async function getPvpEntryData(roleId: string) {
let pvpDefense = await PvpDefenseModel.findByRoleIdIncludeAll(roleId); let pvpDefense = await PvpDefenseModel.findByRoleId(roleId);
if (pvpDefense) { if (pvpDefense) {
// let { pvpDefense, } = await findPvpDefAllByRoleId(roleId); let seasonEndTime = pinus.app.get('pvpSeasonEndTime');
// let { challengeCnt, receivedBox, score, hisScore } = pvpDefense; let refChallengeObj = refChallengeCnt(pvpDefense.challengeCnt, pvpDefense.challengeRefTime, seasonEndTime);
let { challengeCnt } = refChallengeObj;
let { receivedBox, score, hisScore } = pvpDefense;
// return { challengeCnt, score, hisScore, receivedBox } return { challengeCnt, score, hisScore, receivedBox }
} else { } else {
return null return null
} }
+1 -1
View File
@@ -710,7 +710,7 @@ export class Rank {
const rankFromDb = await redisClient().zrevrangeAsync(key, start, end, "WITHSCORES"); const rankFromDb = await redisClient().zrevrangeAsync(key, start, end, "WITHSCORES");
console.log(key, start, end, rankFromDb) // console.log(key, start, end, rankFromDb)
let num = 0; let num = 0;
for (let ii = 0; ii < rankFromDb.length; ii += 2) { for (let ii = 0; ii < rankFromDb.length; ii += 2) {
+2 -1
View File
@@ -143,6 +143,7 @@ function setPvpSeasonNum(pvpConfig: PVPConfigType) {
pinus.app.set('pvpSeasonEndTime', pvpConfig.seasonEndTime); pinus.app.set('pvpSeasonEndTime', pvpConfig.seasonEndTime);
pinus.app.rpc.battle.battleRemote.setPvpSeasonNum.broadcast(pvpConfig); pinus.app.rpc.battle.battleRemote.setPvpSeasonNum.broadcast(pvpConfig);
pinus.app.rpc.role.roleRemote.setPvpSeasonNum.broadcast(pvpConfig); pinus.app.rpc.role.roleRemote.setPvpSeasonNum.broadcast(pvpConfig);
pinus.app.rpc.connector.connectorRemote.setPvpSeasonNum.broadcast(pvpConfig);
} }
} }
@@ -206,7 +207,7 @@ export async function guildActivitySchedule() {
let dicGuildActivity = getTodayGuildActivity(); let dicGuildActivity = getTodayGuildActivity();
await delGuildActivityRank(dicGuildActivity.id); await delGuildActivityRank(dicGuildActivity.id);
console.log(dicGuildActivity) // console.log(dicGuildActivity)
guildActStartJobId = scheduleJob('guildActivityStart', `${dicGuildActivity.startSeconds} ${dicGuildActivity.startMinute} ${dicGuildActivity.startTime} * * ?`, guildActivityStartSchedule); guildActStartJobId = scheduleJob('guildActivityStart', `${dicGuildActivity.startSeconds} ${dicGuildActivity.startMinute} ${dicGuildActivity.startTime} * * ?`, guildActivityStartSchedule);
} }
-2
View File
@@ -110,8 +110,6 @@ export async function checkTaskWithHero(roleId: string, taskType: number, hero:
let oldGrade = gameData.job.get(args[0]).grade; let oldGrade = gameData.job.get(args[0]).grade;
let count = (curGrade - initGrage) * (ABI_STAGE.END - ABI_STAGE.START) + (hero.jobStage - ABI_STAGE.START); // 训练次数 let count = (curGrade - initGrage) * (ABI_STAGE.END - ABI_STAGE.START) + (hero.jobStage - ABI_STAGE.START); // 训练次数
let oldCount = (oldGrade - initGrage) * (ABI_STAGE.END - ABI_STAGE.START) + (args[1] - ABI_STAGE.START); let oldCount = (oldGrade - initGrage) * (ABI_STAGE.END - ABI_STAGE.START) + (args[1] - ABI_STAGE.START);
console.log('******', oldCount);
pushMessage = await checkTask(roleId, taskType, 1, true, { count, oldCount }); pushMessage = await checkTask(roleId, taskType, 1, true, { count, oldCount });
} }
else if (taskType == TASK_TYPE.HERO_QUALITY_UP) { else if (taskType == TASK_TYPE.HERO_QUALITY_UP) {