不删除空数据
This commit is contained in:
		@@ -81,8 +81,17 @@ async function fetch({ albumId, debug = false, update = false }) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (html.includes(`<p class="note s-fc3">很抱歉,你要查找的网页找不到</p>`)) {
 | 
					    if (html.includes(`<p class="note s-fc3">很抱歉,你要查找的网页找不到</p>`)) {
 | 
				
			||||||
        let deleteResult = await dbUtils.query('DELETE FROM song_album_relation WHERE album_id = ?', [albumId]);
 | 
					        // let deleteResult = await dbUtils.query('DELETE FROM song_album_relation WHERE album_id = ?', [albumId]);
 | 
				
			||||||
        console.log(`album: ${albumId} 不存在,从song_album_relation表中删除. affectedRows: ${deleteResult.affectedRows}`);
 | 
					        // console.log(`album: ${albumId} 不存在,从song_album_relation表中删除. affectedRows: ${deleteResult.affectedRows}`);
 | 
				
			||||||
 | 
					        console.log(`album: ${artistId} 不存在,插入空数据`);
 | 
				
			||||||
 | 
					        dbUtils.query('INSERT IGNORE INTO album SET ?', {
 | 
				
			||||||
 | 
					            album_id: albumId,
 | 
				
			||||||
 | 
					            title: '',
 | 
				
			||||||
 | 
					            description: '',
 | 
				
			||||||
 | 
					            image: '',
 | 
				
			||||||
 | 
					            pub_date: '',
 | 
				
			||||||
 | 
					            version: 1
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,8 +69,16 @@ async function fetch({ artistId, debug = false }) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (html.includes(`<p class="note s-fc3">很抱歉,你要查找的网页找不到</p>`)) {
 | 
					    if (html.includes(`<p class="note s-fc3">很抱歉,你要查找的网页找不到</p>`)) {
 | 
				
			||||||
        let deleteResult = await dbUtils.query('DELETE FROM song_artist_relation WHERE artist_id = ?', [artistId]);
 | 
					        // let deleteResult = await dbUtils.query('DELETE FROM song_artist_relation WHERE artist_id = ?', [artistId]);
 | 
				
			||||||
        console.log(`artist: ${artistId} 不存在,从song_artist_relation表中删除. affectedRows: ${deleteResult.affectedRows}`);
 | 
					        // console.log(`artist: ${artistId} 不存在,从song_artist_relation表中删除. affectedRows: ${deleteResult.affectedRows}`);
 | 
				
			||||||
 | 
					        console.log(`artist: ${artistId} 不存在,插入空数据`);
 | 
				
			||||||
 | 
					        dbUtils.query('INSERT IGNORE INTO artist SET ?', {
 | 
				
			||||||
 | 
					            artist_id: artistId,
 | 
				
			||||||
 | 
					            title: '',
 | 
				
			||||||
 | 
					            description: '',
 | 
				
			||||||
 | 
					            image: '',
 | 
				
			||||||
 | 
					            pub_date: '',
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user