Merge branch 'master' into feature/backend
# Conflicts: # game-server/app/servers/connector/handler/entryHandler.ts # game-server/app/servers/role/handler/itemHandler.ts # shared/consts/constModules/sysConst.ts # shared/pubUtils/util.ts # web-server/app.ts # web-server/app/service/Auth.ts
This commit is contained in:
@@ -3,6 +3,8 @@ import * as mongoose from 'mongoose';
|
||||
import { Application, IBoot } from 'egg';
|
||||
import { connectRedis } from './app/pubUtils/redis';
|
||||
import { loadGmDb } from '@db/index';
|
||||
import { SDK_TA_CONST, THINKING_DATA_MODE, THINKING_DATA_MODE_LIST } from '@consts';
|
||||
const ThinkingAnalytics = require("thinkingdata-node");
|
||||
|
||||
export default class FooBoot implements IBoot {
|
||||
private readonly app: Application;
|
||||
@@ -23,6 +25,7 @@ export default class FooBoot implements IBoot {
|
||||
if(this.app.config.env == 'local') {
|
||||
this.app.config.realEnv = 'development';
|
||||
}
|
||||
this.connectThinkingData(this.app);
|
||||
}
|
||||
|
||||
configDidLoad() {
|
||||
@@ -89,6 +92,28 @@ export default class FooBoot implements IBoot {
|
||||
app.context.redisClient = redisClient;
|
||||
}
|
||||
}
|
||||
|
||||
public connectThinkingData(app: Application) {
|
||||
let ta;
|
||||
if(THINKING_DATA_MODE == THINKING_DATA_MODE_LIST.DEBUG) {
|
||||
ta = ThinkingAnalytics.initWithDebugMode(SDK_TA_CONST.APPID, SDK_TA_CONST.SERVER_URL);
|
||||
} else if (THINKING_DATA_MODE == THINKING_DATA_MODE_LIST.BATCH) {
|
||||
ta = ThinkingAnalytics.initWithBatchMode(SDK_TA_CONST.APPID, SDK_TA_CONST.SERVER_URL);
|
||||
} else if (THINKING_DATA_MODE == THINKING_DATA_MODE_LIST.LOGGING) {
|
||||
ta = ThinkingAnalytics.initWithLoggingMode(SDK_TA_CONST.LOG_PATH, {
|
||||
pm2: true
|
||||
});
|
||||
}
|
||||
// ta.setDynamicSuperProperties(() => {
|
||||
// return {
|
||||
// env: app.get('env'),
|
||||
// server: app.getServerId(),
|
||||
// mode: THINKING_DATA_MODE
|
||||
// };
|
||||
// });
|
||||
app.context.ta = ta;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user