feat(线上维护): json线上更新方案

This commit is contained in:
luying
2023-05-19 17:53:46 +08:00
parent 6b02059075
commit d06acfecee
11 changed files with 600 additions and 213 deletions

View File

@@ -2,7 +2,7 @@ import { Application, ChannelService } from 'pinus';
import { guildActivityStart, gateActivityEnd, cityActivityEnd, raceActivityEnd, guildActivitySchedule, auctionSchedule, initMaintenance, stopMaintenance, addMailsToSchedule, updateTimeLimitRank, setLadderCountDown, cancelLadderCountDown, initSumSchedule, setPvpSeasonSchedule, initGVGConfigSchedule, gvgBattleStartSchedule, gvgBattleEndSchedule } from '../../../services/timeTaskService';
import PvpDefenseType from '../../../db/PvpDefense';
import { DicGuildActivity } from '../../../pubUtils/dictionary/DicGuildActivity';
import { reloadResources } from '../../../pubUtils/data';
import { gameData, reloadResources } from '../../../pubUtils/data';
import { setMarquee, cancelMarquee } from '../../../services/gmService';
import { setDicAuctionTime, setDicGuildActivity } from '../../../services/guildActivity/guildActivityService';
import { setWeek } from '../../../pubUtils/timeUtil';
@@ -20,6 +20,7 @@ import { setApiIsClose } from '../../../services/chatService';
import { setKvToMemory } from '../../../services/pushService';
import { setServerGroup } from '../../../services/serverService';
import { setHiddenData } from '../../../services/memoryCache/hiddenData';
import * as dicParam from '../../../pubUtils/dicParam';
export default function (app: Application) {
return new SystimerRemote(app);
@@ -68,9 +69,26 @@ export class SystimerRemote {
/**
* 重载json资源
*/
public async reloadResources() {
public async reloadResources(type?: string) {
try {
reloadResources();
reloadResources(type);
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public async setDicParam(field1: string, field2: string, value: string|number) {
try {
if(dicParam[field1] && dicParam[field1][field2]) dicParam[field1][field2] = value;
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public async setGameDataToApp() {
try {
this.app.set('gameData', gameData);
this.app.set('dicParam', dicParam);
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
@@ -275,4 +293,12 @@ export class SystimerRemote {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public async fun() {
try {
console.log('预留一个函数,用于之后线上维护时需要使用');
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
}