明树Git Lab

Commit 09a8c03a authored by zfp1's avatar zfp1

2

parent fbec1223
...@@ -37,7 +37,7 @@ app.get('/wechat', (req, res) => { ...@@ -37,7 +37,7 @@ app.get('/wechat', (req, res) => {
// 处理微信消息 // 处理微信消息
app.post('/wechat', async (req, res) => { app.post('/wechat', async (req, res) => {
try { // try {
// 1. 验证签名 // 1. 验证签名
if (!validateWechatSignature(req)) { if (!validateWechatSignature(req)) {
console.error('Invalid signature in POST'); console.error('Invalid signature in POST');
...@@ -75,10 +75,10 @@ app.post('/wechat', async (req, res) => { ...@@ -75,10 +75,10 @@ app.post('/wechat', async (req, res) => {
res.set('Content-Type', 'text/xml'); res.set('Content-Type', 'text/xml');
console.log("responseXml:::" ,responseXml); console.log("responseXml:::" ,responseXml);
return res.send(responseXml); return res.send(responseXml);
} catch (error) { // } catch (error) {
console.error('Error processing message:', error); // console.error('Error processing message:', error);
res.status(500).send('Server Error'); // res.status(500).send('Server Error');
} // }
}); });
// 调用DeepSeek API // 调用DeepSeek API
...@@ -121,7 +121,7 @@ function buildTextResponse(message, content) { ...@@ -121,7 +121,7 @@ function buildTextResponse(message, content) {
FromUserName: { _: message.toUser }, FromUserName: { _: message.toUser },
CreateTime: Math.floor(Date.now() / 1000), CreateTime: Math.floor(Date.now() / 1000),
MsgType: 'text', MsgType: 'text',
Content: content Content: String(content)
} }
}); });
} }
......
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