Commit 309287ad authored by 任国军's avatar 任国军

add notify log

parent 7a4e2434
Pipeline #24554 passed with stage
in 1 minute 38 seconds
......@@ -88,7 +88,6 @@ class WechatController extends Controller {
// 支付回调
async payNotify() {
const { ctx } = this;
ctx.set('Content-Type', 'text/xml');
// 组装xml数据
let xmlData = '<xml>';
xmlData += '<return_code><![CDATA[SUCCESS]]></return_code>';
......@@ -96,11 +95,14 @@ class WechatController extends Controller {
xmlData += '</xml>';
ctx.body = xmlData;
ctx.logger.info('notify_headers: ' + JSON.stringify(ctx.request.header));
let data = '';
ctx.req.setEncoding('utf8');
ctx.req.on('data', function(chunk) {
data += chunk;
});
const getxml = await new Promise(function(resolve) {
ctx.req.on('end', function() {
resolve(data);
......@@ -124,6 +126,7 @@ class WechatController extends Controller {
}
}
ctx.set('Content-Type', 'text/xml');
return ctx.body;
}
}
......
......@@ -145,7 +145,7 @@ module.exports = appInfo => {
},
enableTypes: [ 'json', 'form', 'text' ],
extendTypes: {
text: [ 'text/xml', 'application/xml', 'application/x-www-form-urlencoded' ],
text: [ 'text/xml', 'application/xml', 'text/html' ],
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment