From 82f09d89c8ebd4cfdf328973cd4f2621c765e52c Mon Sep 17 00:00:00 2001 From: aixianling Date: Thu, 31 Mar 2022 15:26:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rest/autodeploy/add.js | 1 - rest/autodeploy/list.js | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/rest/autodeploy/add.js b/rest/autodeploy/add.js index 37d4df3..4715c2f 100644 --- a/rest/autodeploy/add.js +++ b/rest/autodeploy/add.js @@ -18,7 +18,6 @@ module.exports = { }) sql = `insert into node_autodeploy (id,${cols.join(",")}) values('${uuid()}',${arr.join(",")})` } - console.log(sql) dbUtils.query(sql).then(() => { response.send({code: 0}) }).catch(err => { diff --git a/rest/autodeploy/list.js b/rest/autodeploy/list.js index 4a42907..482e20c 100644 --- a/rest/autodeploy/list.js +++ b/rest/autodeploy/list.js @@ -3,16 +3,18 @@ module.exports = { action: "/node/autodeploy/list", method: "post", execute: (request, response) => { - let total = 0, records = [] + let total = 0, records = [], {size, current, name} = request.query Promise.all([ dbUtils.query(`select 1 from node_autodeploy`).then(res => { return total = res.length }), new Promise(resolve => { - let sql = `select * from node_autodeploy` + let sql = `select * from node_autodeploy where name like '%${name}%' limit ${(current-1)*size},${size}` dbUtils.query(sql).then(res => { records = res resolve() + }).catch(err => { + response.send({code: 1, err: err.sqlMessage}) }) }) @@ -22,7 +24,5 @@ module.exports = { data: {records, total} }) }) - - } }