插入关联表时同事插入wait_check表;统一查询将要爬取的id代码到dataManager.js
This commit is contained in:
@@ -12,9 +12,6 @@ dbUtils.create({
|
||||
global.dbUtils = dbUtils;
|
||||
console.log("global.useMysqlPool:", !!global.useMysqlPool);
|
||||
|
||||
// 两次请求之间停顿时间
|
||||
global.sleepTime = 10;
|
||||
|
||||
// 引入utils
|
||||
const songInfoUtils = require('./getInfo/songInfoUtils');
|
||||
const artistInfoUtils = require('./getInfo/artistInfoUtils');
|
||||
@@ -57,21 +54,28 @@ async function main(args) {
|
||||
// var affectedRows2 = await dbUtils.query(`DELETE FROM song_album_relation WHERE song_id = 0 OR album_id = 0`, []);
|
||||
// console.log(`删除脏数据 affectedRows:`, affectedRows1.affectedRows, affectedRows2.affectedRows);
|
||||
|
||||
if (args.utils == "song")
|
||||
await songInfoUtils.fetchAll({ args: args });
|
||||
else if (args.utils == "album")
|
||||
await albumInfoUtils.fetchAll({ args: args });
|
||||
else if (args.utils == "artist")
|
||||
await artistInfoUtils.fetchAll({ args: args });
|
||||
else if (args.utils == "lyric")
|
||||
await lyricInfoUtils.fetchAll({ args: args });
|
||||
else if (args.utils == "comment")
|
||||
await commentUtils.fetchAll({ args: args });
|
||||
else if (args.utils == "playlist")
|
||||
await playlistUtils.fetchAll({ args: args });
|
||||
else {
|
||||
console.log("utils参数不匹配,退出");
|
||||
return;
|
||||
switch (args.utils) {
|
||||
case 'song':
|
||||
await songInfoUtils.fetchAll({ args: args });
|
||||
break;
|
||||
case 'album':
|
||||
await albumInfoUtils.fetchAll({ args: args });
|
||||
break;
|
||||
case 'artist':
|
||||
await artistInfoUtils.fetchAll({ args: args });
|
||||
break;
|
||||
case 'lyric':
|
||||
await lyricInfoUtils.fetchAll({ args: args });
|
||||
break;
|
||||
case 'comment':
|
||||
await commentUtils.fetchAll({ args: args });
|
||||
break;
|
||||
case 'playlist':
|
||||
await playlistUtils.fetchAll({ args: args });
|
||||
break;
|
||||
default:
|
||||
console.log("utils参数不匹配,退出");
|
||||
return;
|
||||
}
|
||||
await sleepUtils.sleep(2000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user