pvp:首页推送
This commit is contained in:
@@ -4,6 +4,7 @@ import { resResult } from '../../../pubUtils/util';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
import { UserGuildType } from '../../../db/UserGuild';
|
||||
import { kickUser } from '../../../services/connectorService';
|
||||
import { PVPConfigType } from '../../../db/SystemConfig';
|
||||
export default function (app: Application) {
|
||||
new HandlerService(app, {});
|
||||
return new ConnectorRemote(app);
|
||||
@@ -51,4 +52,11 @@ export class ConnectorRemote {
|
||||
public getServerMainten() {
|
||||
return this.maintenServers;
|
||||
}
|
||||
|
||||
public setPvpSeasonNum(pvpConfig: PVPConfigType) {
|
||||
if(pvpConfig) {
|
||||
this.app.set('pvpSeasonNum', pvpConfig.seasonNum);
|
||||
this.app.set('pvpSeasonEndTime', pvpConfig.seasonEndTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import { getAllOnlineRoles } from './redisService';
|
||||
import Item from '../db/Item';
|
||||
import { PvpDefenseModel } from '../db/PvpDefense';
|
||||
import { getDonation } from './donateService';
|
||||
import { refChallengeCnt } from './pvpService';
|
||||
|
||||
export async function pushData(role: RoleType, session: FrontendOrBackendSession, pushType: 'entry' | 'refresh' = 'entry') {
|
||||
try {
|
||||
@@ -188,12 +189,14 @@ async function getTowerEntryData(role: RoleType) {
|
||||
* @param roleId
|
||||
*/
|
||||
async function getPvpEntryData(roleId: string) {
|
||||
let pvpDefense = await PvpDefenseModel.findByRoleIdIncludeAll(roleId);
|
||||
let pvpDefense = await PvpDefenseModel.findByRoleId(roleId);
|
||||
if (pvpDefense) {
|
||||
// let { pvpDefense, } = await findPvpDefAllByRoleId(roleId);
|
||||
// let { challengeCnt, receivedBox, score, hisScore } = pvpDefense;
|
||||
let seasonEndTime = pinus.app.get('pvpSeasonEndTime');
|
||||
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 {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -710,7 +710,7 @@ export class Rank {
|
||||
|
||||
const rankFromDb = await redisClient().zrevrangeAsync(key, start, end, "WITHSCORES");
|
||||
|
||||
console.log(key, start, end, rankFromDb)
|
||||
// console.log(key, start, end, rankFromDb)
|
||||
|
||||
let num = 0;
|
||||
for (let ii = 0; ii < rankFromDb.length; ii += 2) {
|
||||
|
||||
@@ -143,6 +143,7 @@ function setPvpSeasonNum(pvpConfig: PVPConfigType) {
|
||||
pinus.app.set('pvpSeasonEndTime', pvpConfig.seasonEndTime);
|
||||
pinus.app.rpc.battle.battleRemote.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();
|
||||
await delGuildActivityRank(dicGuildActivity.id);
|
||||
|
||||
console.log(dicGuildActivity)
|
||||
// console.log(dicGuildActivity)
|
||||
|
||||
guildActStartJobId = scheduleJob('guildActivityStart', `${dicGuildActivity.startSeconds} ${dicGuildActivity.startMinute} ${dicGuildActivity.startTime} * * ?`, guildActivityStartSchedule);
|
||||
}
|
||||
|
||||
@@ -110,8 +110,6 @@ export async function checkTaskWithHero(roleId: string, taskType: number, hero:
|
||||
let oldGrade = gameData.job.get(args[0]).grade;
|
||||
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);
|
||||
|
||||
console.log('******', oldCount);
|
||||
pushMessage = await checkTask(roleId, taskType, 1, true, { count, oldCount });
|
||||
}
|
||||
else if (taskType == TASK_TYPE.HERO_QUALITY_UP) {
|
||||
|
||||
Reference in New Issue
Block a user