优化排列顺序
This commit is contained in:
@@ -6,7 +6,7 @@ module.exports = {
|
|||||||
let {size, current, name, type} = 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, type}
|
search: {size, current, type}, sort: 'download'
|
||||||
}).then(data => {
|
}).then(data => {
|
||||||
response.send({code: 0, data})
|
response.send({code: 0, data})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ module.exports = {
|
|||||||
console.log(`${chalk.bgBlue.black(" DATABASE ")} 数据库已连接`)
|
console.log(`${chalk.bgBlue.black(" DATABASE ")} 数据库已连接`)
|
||||||
},
|
},
|
||||||
query,
|
query,
|
||||||
list: ({table, search, con = ''}) => {
|
list: ({table, search, con = '', sort}) => {
|
||||||
//列表查询
|
//列表查询
|
||||||
let total = 0, records = []
|
let total = 0, records = []
|
||||||
if (table) {
|
if (table) {
|
||||||
@@ -38,7 +38,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)||0)*size},${size||10}`).then(res => {
|
query(`select * from ${table} where name like '%${con}%' ${sqlCon} limit ${((current-1)||0)*size},${size||10} order by ${sort||'createTime'} desc`).then(res => {
|
||||||
return records = res
|
return records = res
|
||||||
})
|
})
|
||||||
]).then(() => {
|
]).then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user