From f57e7682a1564a19da72f0eafa0ab90591fb8eb1 Mon Sep 17 00:00:00 2001 From: luying Date: Fri, 19 Nov 2021 14:48:32 +0800 Subject: [PATCH] =?UTF-8?q?sdk=EF=BC=9A=E5=B1=8F=E8=94=BD=E8=AF=8D?= =?UTF-8?q?=E5=BA=93=E5=8A=A0=E8=BD=BD=E5=A4=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game-server/app.ts | 7 ++++++- game-server/app/servers/chat/remote/chatRemote.ts | 1 - game-server/app/services/sdkService.ts | 1 + shared/pubUtils/data.ts | 12 ++++++------ 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/game-server/app.ts b/game-server/app.ts index 89c947ff0..60e64cb6b 100644 --- a/game-server/app.ts +++ b/game-server/app.ts @@ -27,7 +27,7 @@ import _pinus = require('pinus'); import { updateTeamStatus } from './app/services/comBattleService'; import { resResult, genCode } from './app/pubUtils/util'; import { errlogger, infologger } from './app/util/logger'; -import { connectThinkingData } from './app/services/sdkService'; +import { connectThinkingData, getTire } from './app/services/sdkService'; const filePath = (_pinus as any).FILEPATH; filePath.MASTER = '/config/master'; @@ -131,6 +131,11 @@ app.configure(ALL_ENVS, 'systimer', function () { }); }); +app.configure(ALL_ENVS, 'chat', function() { + app.afterStart(() => { + getTire(); + }) +}); function errorHandler(err: Error, msg: any, resp: any, session: FrontendOrBackendSession, cb: HandlerCallback) { diff --git a/game-server/app/servers/chat/remote/chatRemote.ts b/game-server/app/servers/chat/remote/chatRemote.ts index 090367e45..ce83a36cd 100644 --- a/game-server/app/servers/chat/remote/chatRemote.ts +++ b/game-server/app/servers/chat/remote/chatRemote.ts @@ -35,7 +35,6 @@ export class ChatRemote { constructor(private app: Application) { this.app = app; this.channelService = app.get('channelService'); - getTire(); } private channelService: ChannelService; diff --git a/game-server/app/services/sdkService.ts b/game-server/app/services/sdkService.ts index 7b9b75573..c9ce0ee8c 100644 --- a/game-server/app/services/sdkService.ts +++ b/game-server/app/services/sdkService.ts @@ -208,6 +208,7 @@ export async function fetch37Words() { } export async function getTire() { + console.log('**********getTire') let trie = pinus.app.get('tire'); if(!trie) { let blockWords = readWordTxt(FILENAME.FILTER_WORDS); diff --git a/shared/pubUtils/data.ts b/shared/pubUtils/data.ts index 9a8f3e3e7..baf9f7225 100644 --- a/shared/pubUtils/data.ts +++ b/shared/pubUtils/data.ts @@ -854,30 +854,30 @@ function parseDicParam() { * group为如果两个任务,除了condition以外的其他所有taskParam都是一样的,他们的group相同 */ function treatTaskGroup() { + console.log('****** treatTaskGroup') let taskType2Desc = new Map(); for(let obj of gameData.taskTypeDesc) { taskType2Desc.set(obj.id, obj); } - let taskByGroup = new Map(); // taskType => obj + let taskByGroup = new Map(); // taskType => obj for(let [taskType, tasks] of gameData.taskType) { for(let obj of tasks) { let dicTaskType = taskType2Desc.get(taskType); let index = dicTaskType.param.split('&').indexOf(dicTaskType.condition); - console.log(index); let params = obj.taskParam.filter((_, i) => index != i); // console.log('params: ', obj.id, obj.type, obj.taskType, obj.taskParam, obj.condition, params); if(!taskByGroup.has(taskType)) { - taskByGroup.set(taskType, [{ params, ids: [obj.id]}]); + taskByGroup.set(taskType, [{ params, ids: [`${obj.type}${obj.id}`]}]); } else { let arr = taskByGroup.get(taskType)||[]; let hasGroup = arr.find(cur => { return _.isEqual(cur.params, params); }); if(hasGroup) { - hasGroup.ids.push(obj.id); + hasGroup.ids.push(`${obj.type}${obj.id}`); } else { - arr.push({ params, ids: [obj.id] }); + arr.push({ params, ids: [`${obj.type}${obj.id}`] }); } taskByGroup.set(taskType, arr); } @@ -890,7 +890,7 @@ function treatTaskGroup() { let group = i + 1; let { ids } = arr[i]; for(let id of ids) { - let task = tasks.find(cur => cur.id == id); + let task = tasks.find(cur => `${cur.type}${cur.id}` == id); if(task) task.group = group; } }