明树Git Lab

Commit 524c55bd authored by zfp1's avatar zfp1

1

parent 711ce942
...@@ -3,6 +3,9 @@ const axios = require('axios'); ...@@ -3,6 +3,9 @@ const axios = require('axios');
const xml2js = require('xml2js'); const xml2js = require('xml2js');
const crypto = require('crypto'); const crypto = require('crypto');
const app = express(); const app = express();
app.use(express.text({ type: 'text/xml' }));
const port = 3001; const port = 3001;
// 微信服务号配置 // 微信服务号配置
...@@ -45,7 +48,7 @@ function escapeXml(str) { ...@@ -45,7 +48,7 @@ function escapeXml(str) {
} }
// 处理微信消息 // 处理微信消息
app.post('/wechat', express.raw({ type: 'application/xml' }), async (req, res) => { app.post('/wechat', async (req, res) => {
const parser = new xml2js.Parser({ explicitArray: false, ignoreAttrs: true }); const parser = new xml2js.Parser({ explicitArray: false, ignoreAttrs: true });
try { try {
......
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