活动:微信支付

This commit is contained in:
qiaoxin
2021-05-12 17:57:38 +08:00
parent 7e93c2e6a3
commit 2fc5017af8
11 changed files with 915 additions and 52 deletions
+13 -12
View File
@@ -54,7 +54,7 @@ let app = pinus.createApp();
app.set('name', 'chatofpomelo-websocket');
// 加载数据库和redis
app.configure(function() {
app.configure(function () {
app.loadConfig('database', app.getBase() + '/config/database');
console.log('env:', app.get('env'));
console.log('db:', app.get('database'));
@@ -139,15 +139,15 @@ app.configure(ALL_ENVS, 'systimer', function () {
connector: pinus.connectors.hybridconnector,
useProtobuf: true
});
timeTaskService.init();
timeTaskService.init();
});
function errorHandler(err: Error, msg: any, resp: any,
session: FrontendOrBackendSession, cb: HandlerCallback) {
console.error(`${ pinus.app.serverId } error handler msg[${ JSON.stringify(msg) }] ,resp[${ JSON.stringify(resp) }] ,
to resolve unknown exception: sessionId:${ JSON.stringify(session.export()) } ,
error stack: ${ err.stack }`);
session: FrontendOrBackendSession, cb: HandlerCallback) {
console.error(`${pinus.app.serverId} error handler msg[${JSON.stringify(msg)}] ,resp[${JSON.stringify(resp)}] ,
to resolve unknown exception: sessionId:${JSON.stringify(session.export())} ,
error stack: ${err.stack}`);
if (!resp) {
resp = resResult(STATUS.GLOBAL_ERR);
}
@@ -155,10 +155,10 @@ function errorHandler(err: Error, msg: any, resp: any,
}
export function globalErrorHandler(err: Error, msg: any, resp: any,
session: FrontendOrBackendSession, cb: HandlerCallback) {
console.error(`${ pinus.app.serverId } globalErrorHandler msg[${ JSON.stringify(msg) }] ,resp[${ JSON.stringify(resp) }] ,
to resolve unknown exception: sessionId:${ JSON.stringify(session.export()) } ,
error stack: ${ err.stack }`);
session: FrontendOrBackendSession, cb: HandlerCallback) {
console.error(`${pinus.app.serverId} globalErrorHandler msg[${JSON.stringify(msg)}] ,resp[${JSON.stringify(resp)}] ,
to resolve unknown exception: sessionId:${JSON.stringify(session.export())} ,
error stack: ${err.stack}`);
if (cb) {
@@ -171,12 +171,12 @@ app.configure(ALL_ENVS, function () {
app.set(RESERVED.ERROR_HANDLER, errorHandler);
app.set(RESERVED.GLOBAL_ERROR_HANDLER, globalErrorHandler);
app.globalAfter((err: Error, routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, resp: any, cb: HandlerCallback) => {
console.log('global after ', err, msg&&msg.route, msg&&JSON.stringify(msg.body), session&&session.get('roleId'))
console.log('global after ', err, msg && msg.route, msg && JSON.stringify(msg.body), session && session.get('roleId'))
})
app.globalBefore((routeRecord: RouteRecord, msg: any, session: FrontendOrBackendSession, cb: HandlerCallback) => {
if (msg.body === null) {
cb(new Error(`msg body ===null maybe protobuf check error uid:${ session.uid } ${ JSON.stringify(msg) }`), { code: 499 });
cb(new Error(`msg body ===null maybe protobuf check error uid:${session.uid} ${JSON.stringify(msg)}`), { code: 499 });
return;
}
cb(null);
@@ -188,6 +188,7 @@ app.configure(ALL_ENVS, function () {
app.route('gm', routeUtil.gm);
app.route('guild', routeUtil.guild);
app.route('activity', routeUtil.activity);
app.route('order', routeUtil.order);
// filter configures
app.filter(new pinus.filters.time());