|
|
@ -2008,7 +2008,9 @@ app.post('/api/supplies/log', async (req, res) => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 3. 插入日志到informationtra表
|
|
|
// 3. 插入日志到informationtra表
|
|
|
const connection = await pool.getConnection(); |
|
|
let connection; |
|
|
|
|
|
try { |
|
|
|
|
|
connection = await pool.getConnection(); |
|
|
const [result] = await connection.query( |
|
|
const [result] = await connection.query( |
|
|
`INSERT INTO informationtra (
|
|
|
`INSERT INTO informationtra (
|
|
|
tracompany, tradepartment, traorganization, trarole, |
|
|
tracompany, tradepartment, traorganization, trarole, |
|
|
@ -2030,12 +2032,18 @@ app.post('/api/supplies/log', async (req, res) => { |
|
|
logData.changedFields |
|
|
logData.changedFields |
|
|
] |
|
|
] |
|
|
); |
|
|
); |
|
|
connection.release(); |
|
|
|
|
|
|
|
|
|
|
|
sendResponse(res, true, { logId: result.insertId }, '日志记录成功'); |
|
|
sendResponse(res, true, { logId: result.insertId }, '日志记录成功'); |
|
|
} catch (error) { |
|
|
} catch (error) { |
|
|
console.error('记录日志失败:', error); |
|
|
console.error('记录日志失败:', error); |
|
|
sendResponse(res, false, null, '记录日志失败'); |
|
|
sendResponse(res, false, null, '记录日志失败'); |
|
|
|
|
|
} finally { |
|
|
|
|
|
if (connection) { |
|
|
|
|
|
connection.release(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
console.error('记录日志失败:', error); |
|
|
|
|
|
sendResponse(res, false, null, '记录日志失败'); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|