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

@@ -1,6 +1,6 @@
import { Application, ChannelService, HandlerService, } from 'pinus';
// import { sendRolesMails } from '../../../services/mailService';
import { reloadResources } from '../../../pubUtils/data';
import { gameData, reloadResources } from '../../../pubUtils/data';
import { RankFirstModel, RankFirstType } from '../../../db/RankFirst';
import { PVPConfigModel, PVPConfigType } from '../../../db/PvpConfig';
import { treatRoleName, taflush, sendSurveyMail, sendGiftCodeMail } from '../../../services/sdkService';
@@ -14,6 +14,7 @@ import { DEBUG_MAGIC_WORD, MAIL_TYPE } from '../../../consts';
import { ActivityTimeLimitRankModel } from '../../../db/ActivityTimeLimitRank';
import { RoleModel } from '../../../db/Role';
import { sendMailToManyPlayerByContent } from '../../../services/mailService';
import * as dicParam from '../../../pubUtils/dicParam';
export default function (app: Application) {
new HandlerService(app, {});
@@ -67,14 +68,30 @@ export class RoleRemote {
/**
* 重载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}`);
}
}
public async setPvpSeasonNum(pvpConfig: PVPConfigType) {
try {
@@ -197,4 +214,12 @@ export class RoleRemote {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
public async fun() {
try {
console.log('预留一个函数,用于之后线上维护时需要使用');
} catch(e) {
errlogger.error(`remote ${__filename} \n ${e.stack}`);
}
}
}