修复异常
This commit is contained in:
@@ -3,10 +3,10 @@ module.exports = {
|
|||||||
action: "/node/custom/list",
|
action: "/node/custom/list",
|
||||||
method: "post",
|
method: "post",
|
||||||
execute: (request, response) => {
|
execute: (request, response) => {
|
||||||
let {size, current, name} = request.query
|
let {size, current, name, type} = request.query
|
||||||
dbUtils.list({
|
dbUtils.list({
|
||||||
table: 'node_custom_config', con: name,
|
table: 'node_custom_config', con: name,
|
||||||
search: {size, current}
|
search: {size, current, type}
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
response.send({code: 0, data})
|
response.send({code: 0, data})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module.exports = {
|
|||||||
this.pool = mysql.createPool(dbConfig)
|
this.pool = mysql.createPool(dbConfig)
|
||||||
},
|
},
|
||||||
query,
|
query,
|
||||||
list: ({table, search, con}) => {
|
list: ({table, search, con = ''}) => {
|
||||||
//列表查询
|
//列表查询
|
||||||
let total = 0, records = []
|
let total = 0, records = []
|
||||||
if (table) {
|
if (table) {
|
||||||
@@ -37,7 +37,7 @@ module.exports = {
|
|||||||
query(`select 1 from ${table} where name like '%${con}%' ${sqlCon}`).then(res => {
|
query(`select 1 from ${table} where name like '%${con}%' ${sqlCon}`).then(res => {
|
||||||
return total = res.length
|
return total = res.length
|
||||||
}),
|
}),
|
||||||
query(`select * from ${table} where name like '%${con}%' ${sqlCon} limit ${(current-1)*size},${size||10}`).then(res => {
|
query(`select * from ${table} where name like '%${con}%' ${sqlCon} limit ${((current-1)||0)*size},${size||10}`).then(res => {
|
||||||
return records = res
|
return records = res
|
||||||
})
|
})
|
||||||
]).then(() => {
|
]).then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user