feat: wxmsg 数据格式JSON兼容;compose v1.3.12

This commit is contained in:
2026-09-14 10:29:27 +08:00
parent d9e0096322
commit 95a28390dd
2 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ services:
- mongo_data:/data/db
dimension-server:
image: dim-server:v1.3.11
image: dim-server:v1.3.12
restart: unless-stopped
depends_on:
- mongodb
+7 -2
View File
@@ -38,8 +38,13 @@ module.exports = function registerWxMsgRoutes(app) {
app.post('/api/wx/msg', async (req, res) => {
try {
const raw = typeof req.body === 'string' ? req.body : JSON.stringify(req.body || {})
const fields = xmlFields(String(raw))
// 数据格式推荐 JSON:express.json 已解析为对象;选 XML 时是字符串
let fields = {}
if (req.body && typeof req.body === 'object') {
fields = req.body
} else {
fields = xmlFields(String(req.body || ''))
}
const event = fields.Event || fields.event || ''
console.log('[wx-msg] 收到推送 Event=' + event, JSON.stringify(fields).slice(0, 500))
// TODO(vpay接入):按事件分发改写用户星尘余额/发货状态