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