From 9a8565a1e3aa8dd103bd5486b31e4472bbcfed55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98=E5=B0=8F=E5=A2=A8?= <2291200076@qq.com> Date: Thu, 20 Oct 2022 22:31:13 +0800 Subject: [PATCH] =?UTF-8?q?SQL=20=3F=E4=BC=A0=E9=80=92array=E8=A6=81?= =?UTF-8?q?=E8=80=83=E8=99=91=E6=95=B0=E7=BB=84=E4=B8=BA=E7=A9=BA=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netease_music/src/getInfo/albumInfoUtils.js | 2 +- netease_music/src/getInfo/artistInfoUtils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netease_music/src/getInfo/albumInfoUtils.js b/netease_music/src/getInfo/albumInfoUtils.js index af96dea..22ff399 100644 --- a/netease_music/src/getInfo/albumInfoUtils.js +++ b/netease_music/src/getInfo/albumInfoUtils.js @@ -159,7 +159,7 @@ async function fetch({ albumId, debug = false, update = false }) { songIds: songIds, }; // console.log("albumInfo", albumInfo); - if (albumId > 0) { + if (albumId > 0 && songIds.length > 0) { await dbUtils.query(` INSERT IGNORE INTO song_album_relation (song_id, album_id) VALUES ? `, [songIds.map(songId => [Number(songId), albumId])]); diff --git a/netease_music/src/getInfo/artistInfoUtils.js b/netease_music/src/getInfo/artistInfoUtils.js index dd40c5a..928bdba 100644 --- a/netease_music/src/getInfo/artistInfoUtils.js +++ b/netease_music/src/getInfo/artistInfoUtils.js @@ -110,7 +110,7 @@ async function fetch({ artistId, debug = false }) { songIds: songIds, }; // console.log("artistInfo", artistInfo); - if (artistId > 0) { + if (artistId > 0 && songIds.length > 0) { await dbUtils.query(` INSERT IGNORE INTO song_artist_relation (song_id, artist_id) VALUES ? `, [songIds.map(songId => [Number(songId), artistId])]);