sdk:添加log

This commit is contained in:
luying
2022-05-10 10:02:19 +08:00
parent 6e8dce5d7b
commit 5e26765cfd

View File

@@ -33,46 +33,46 @@ export default class Sdk extends Service {
let checkResult = this.check37Sign(params);
if(!checkResult) return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.MD5_ERR, '');
console.log('*****pay37Callback check sign ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check sign ok`);
if(gameData.whiteip.indexOf(ctx.clientIp) == -1) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.IP_LIMIT, '');
}
console.log('*****pay37Callback check ip ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check ip ok`);
if(nowSeconds() - params.time > 15 * 60) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.TIME_IS_EXPIRED, '');
}
console.log('*****pay37Callback check time ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check time ok`);
let order = await UserOrderModel.findOrder(params.order_no);
if(!order) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.FAIL, '');
}
console.log('*****pay37Callback check order ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check order ok`);
if(order.state != ORDER_STATE.APPLY) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.SUCCESS, '');
}
console.log('*****pay37Callback check order status ok', params.money, typeof params.money)
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check order status ok ${params.money} ${typeof params.money}`);
if(order.price != parseFloat(params.money)) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.PAY_ERR, '');
}
console.log('*****pay37Callback check money ok', order.price, params.money)
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check money ok ${order.price} ${params.money}`);
let role = await RoleModel.findByRoleId(order.roleId);
if(!role) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.ROLE_NOT_FOUND, '');
}
console.log('*****pay37Callback check role ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check role ok`);
if(role.serverId != params.sid) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.SERVER_NOT_FOUND, '');
}
console.log('*****pay37Callback check server ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback check server ok`);
order = await UserOrderModel.check(order.roleId, order.localOrderID);
if(!order) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.FAIL, '');
}
console.log('*****pay37Callback save order check ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback save order check ok`);
let redisClient: RedisClient = app.context.redisClient;
let name = getRedisSubChannel(REDIS_KEY.PAY_CHANNEL, app.config.env);
@@ -80,7 +80,7 @@ export default class Sdk extends Service {
if(result == 0) {
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.SERVER_IS_BUSY, '');
}
console.log('*****pay37Callback redis publish ok')
ctx.service.utils.log('DEBUG', `[${ctx.request.url}] [${ctx.logcode}] pay37Callback redis publish ok`);
return ctx.service.utils.resResult(PAY_37_CALLBACK_CODE.SUCCESS, '');
}