调整接口

This commit is contained in:
aixianling
2023-02-10 19:33:57 +08:00
parent 46287ac2f5
commit 0a928d8231
2 changed files with 26 additions and 4 deletions

View File

@@ -8,7 +8,22 @@ module.exports = {
action: "/node/monitorApi/addOrUpdate",
method: "post",
execute: (request, response) => {
Promise.all([request.body].flat().map(e => addLog(e))).then(data => {
dbUtils.batchInsert({
table: 'node_api_logs',
list: [request.body].flat().map(({id, status, path, device, url, createTime, nodeProcess, method, code, userName, error}) => ({
id,
status,
path,
device,
url,
createTime,
nodeProcess,
method,
code,
userName,
error
}))
}).then(data => {
response.send({code: 0, data})
}).catch(err => {
response.send({code: 1, err: err?.sqlMessage || err || ""})