后台:修复部分遗漏
This commit is contained in:
@@ -112,6 +112,10 @@ export class GmHandler {
|
||||
for(let { id } of systimerServers) {
|
||||
await this.app.rpc.systimer.systimerRemote.reloadResources.toServer(id);
|
||||
}
|
||||
let orderServers = this.app.getServersByType('order');
|
||||
for(let { id } of orderServers) {
|
||||
await this.app.rpc.order.orderRemote.reloadResources.toServer(id);
|
||||
}
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
isOK: true
|
||||
});
|
||||
|
||||
23
game-server/app/servers/order/remote/orderRemote.ts
Normal file
23
game-server/app/servers/order/remote/orderRemote.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Application, ChannelService } from 'pinus';
|
||||
import { reloadResources } from '../../../pubUtils/data';
|
||||
|
||||
export default function (app: Application) {
|
||||
return new OrderRemote(app);
|
||||
}
|
||||
|
||||
export class OrderRemote {
|
||||
|
||||
constructor(private app: Application) {
|
||||
this.app = app;
|
||||
this.channelService = app.get('channelService');
|
||||
}
|
||||
|
||||
private channelService: ChannelService;
|
||||
|
||||
/**
|
||||
* 重载json资源
|
||||
*/
|
||||
public async reloadResources() {
|
||||
reloadResources();
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import { RoleRemote } from './role/remote/roleRemote';
|
||||
import { GuildActivityRemote } from './guild/remote/guildActivityRemote';
|
||||
import { GuildRemote as GuildRemote2 } from './guild/remote/guildRemote';
|
||||
import { ActivityRemote } from './activity/remote/activityRemote';
|
||||
import { OrderRemote } from './order/remote/orderRemote';
|
||||
declare global {
|
||||
interface UserRpc {
|
||||
activity: {
|
||||
@@ -42,6 +43,9 @@ declare global {
|
||||
},
|
||||
role: {
|
||||
roleRemote: RemoterClass<FrontendSession, RoleRemote>;
|
||||
},
|
||||
order: {
|
||||
orderRemote: RemoterClass<FrontendSession, OrderRemote>;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TASK_TYPE, ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../consts';
|
||||
import { ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityBuyRecordsModelType } from '../../db/ActivityBuyRecords';
|
||||
import { ActivityGrowthFundModelType } from '../../db/ActivityGrowthFund';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import moment = require('moment');
|
||||
import { ACTIVITY_RESOURCES_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivityShopModelType } from '../../db/ActivityShop';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { SELF_SERVICE_SHOP_CELL_TYPE, ACTIVITY_RESOURCES_TYPE, ACTIVITY_TYPE } from '../../consts';
|
||||
import { ActivityModelType } from '../../db/Activity';
|
||||
import { ActivitySelfServiceShopModelType } from '../../db/ActivitySelfServiceShop';
|
||||
import { deltaDays } from '../../pubUtils/util';
|
||||
import { ActivityBase } from './activityField';
|
||||
|
||||
// 自助商店数据坑位数据
|
||||
|
||||
@@ -81,6 +81,7 @@ import { dicGacha, loadGacha } from "./dictionary/DicGacha";
|
||||
import { dicGachaContent, dicGachaContentHero, loadGachaContent } from "./dictionary/DicGachaContent";
|
||||
import { dicGiftPackage, loadGiftPackage } from "./dictionary/DicGiftPackage";
|
||||
import { dicRecruit, loadRecruit } from './dictionary/DicRecruit';
|
||||
import { loadRMB } from './dictionary/DicRMB';
|
||||
|
||||
export const gameData = {
|
||||
blurprtCompose: dicBlueprtCompose,
|
||||
@@ -756,34 +757,37 @@ function loadDatas() {
|
||||
loadGachaContent();
|
||||
loadGiftPackage();
|
||||
loadRecruit();
|
||||
loadRMB();
|
||||
}
|
||||
|
||||
// 重载dicParam
|
||||
export function reloadDicParam() {
|
||||
let file = readTsFile('dicParam');
|
||||
|
||||
let lines = file.split('\n');
|
||||
let outer = '';
|
||||
lines.forEach(line => {
|
||||
if(line.replace(/ /g, '')) {
|
||||
if(line.indexOf('export') != -1) {
|
||||
outer = line.split(' ')[2];
|
||||
// console.log(outer)
|
||||
}
|
||||
if(line.indexOf('export') == -1 && line.indexOf('}') == -1) {
|
||||
let s = line.split(', //')[0].split(':');
|
||||
let key = s[0].replace(/ /g, '');
|
||||
let value = s[1].replace(/ /g, '');
|
||||
let isString = value.match(/(?<=')[^']*/);
|
||||
if(isString) {
|
||||
param[outer][key] = isString[0];
|
||||
} else {
|
||||
param[outer][key] = parseFloat(value);
|
||||
if(file) {
|
||||
let lines = file.split('\n');
|
||||
let outer = '';
|
||||
lines.forEach(line => {
|
||||
if(line.replace(/ /g, '')) {
|
||||
if(line.indexOf('export') != -1) {
|
||||
outer = line.split(' ')[2];
|
||||
// console.log(outer)
|
||||
}
|
||||
if(line.indexOf('export') == -1 && line.indexOf('}') == -1) {
|
||||
let s = line.split(', //')[0].split(':');
|
||||
let key = s[0].replace(/ /g, '');
|
||||
let value = s[1].replace(/ /g, '');
|
||||
let isString = value.match(/(?<=')[^']*/);
|
||||
if(isString) {
|
||||
param[outer][key] = isString[0];
|
||||
} else {
|
||||
param[outer][key] = parseFloat(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
parseDicParam();
|
||||
});
|
||||
parseDicParam();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 后台调用重载资源
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
import { readJsonFile, parseGoodStr } from '../util'
|
||||
import { FILENAME } from '../../consts'
|
||||
type KeysEnum<T> = { [P in keyof Required<T>]: true };
|
||||
import { RewardInter } from '../interface';
|
||||
const _ = require('lodash');
|
||||
|
||||
export interface DicArmyBossRank {
|
||||
readonly id: number;
|
||||
readonly rankMin: number;
|
||||
readonly rankMax: number;
|
||||
readonly reward: Array<RewardInter>;
|
||||
}
|
||||
|
||||
const DicArmyBossRankKeys: KeysEnum<DicArmyBossRank> = {
|
||||
id: true,
|
||||
rankMin: true,
|
||||
rankMax: true,
|
||||
reward: true,
|
||||
};
|
||||
|
||||
const str = readJsonFile(FILENAME.DIC_ARMY_BOSS_RANK_REWARD);
|
||||
let arr = JSON.parse(str);
|
||||
|
||||
export const dicArmyBossRank = new Array<DicArmyBossRank>();
|
||||
arr.forEach(o => {
|
||||
o.reward = parseGoodStr(o.reward);
|
||||
dicArmyBossRank.push(_.pick(o, Object.keys(DicArmyBossRankKeys)));
|
||||
});
|
||||
arr = undefined;
|
||||
@@ -405,8 +405,12 @@ export function readWarJsonFileList() {
|
||||
}
|
||||
|
||||
export function readTsFile(fileName: string) {
|
||||
let file = fs.readFileSync(path.resolve(__dirname, `../pubUtils/${fileName}.ts`)).toString('utf8').replace(/^\uFEFF/, '');
|
||||
return file;
|
||||
try {
|
||||
let file = fs.readFileSync(path.resolve(__dirname, `../pubUtils/${fileName}.ts`)).toString('utf8').replace(/^\uFEFF/, '');
|
||||
return file;
|
||||
} catch(e) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
export function readFileAndParse(fileName: string) {
|
||||
|
||||
@@ -20,7 +20,8 @@ function aesDecrypt(data, key, iv) {
|
||||
module.exports = options => {
|
||||
return async function parmsDecode(ctx: Context, next) {
|
||||
let m = ctx.request.url.indexOf("/dev");
|
||||
if(m == 0) {
|
||||
let n = ctx.request.url.indexOf("/web");
|
||||
if(m == 0 || n == 0) {
|
||||
await next();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user