1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

hifini 添加 order limit 参数

This commit is contained in:
程序员小墨 2022-10-29 14:40:58 +08:00
parent 71eb3b7ce5
commit b93e1598e6
4 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,2 @@
start cmd /k "node index --order DESC --limit 200"
exit

View File

@ -1,2 +1,2 @@
start cmd /k "node index" start cmd /k "node index --order ASC --limit 200"
exit exit

View File

@ -14,6 +14,11 @@ const dataManager = require('./src/dataManager');
const requestUtils = require('../utils/requestUtils'); const requestUtils = require('../utils/requestUtils');
async function main() { async function main() {
var args = require('minimist')(process.argv.slice(2));
global.args = {
"order": args.order,
"limit": args.limit,
}
// async function timeout1() { // async function timeout1() {
// await getList(); // await getList();
// setTimeout(() => console.log("getList已完成"), 2000); // setTimeout(() => console.log("getList已完成"), 2000);

View File

@ -20,11 +20,23 @@ module.exports = {
}, },
getIdsToFetch: async () => { getIdsToFetch: async () => {
return await dbUtils.query(`SELECT thread_id FROM hifini_thread where music_title='' and music_pic='' and music_url=''`); let sql = `
SELECT thread_id FROM hifini_thread WHERE music_title='' and music_pic='' and music_url=''
${global.args?.order ? `ORDER BY thread_id ${global.args.order}` : ""}
${global.args?.limit ? `LIMIT ${global.args.limit}` : ""}
`;
console.log(sql);
return await dbUtils.query(sql);
}, },
getIdsToFetchRealUrl: async () => { getIdsToFetchRealUrl: async () => {
return await dbUtils.query(`SELECT thread_id,music_url FROM hifini_thread where music_url like 'get_music.php?key=%' and music_real_url=''`); let sql = `
SELECT thread_id,music_url FROM hifini_thread WHERE music_url like 'get_music.php?key=%' and music_real_url=''
${global.args?.order ? `ORDER BY thread_id ${global.args.order}` : ""}
${global.args?.limit ? `LIMIT ${global.args.limit}` : ""}
`;
console.log(sql);
return await dbUtils.query(sql);
} }
}, },