SQL ?传递array要考虑数组为空情况
This commit is contained in:
parent
4f3aa180a0
commit
9a8565a1e3
@ -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])]);
|
||||
|
@ -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])]);
|
||||
|
Loading…
Reference in New Issue
Block a user