增加搜索推荐

This commit is contained in:
2025-09-04 12:55:17 +08:00
parent 2cc36fa8b9
commit 66e274e234
8 changed files with 532 additions and 20 deletions
+42
View File
@@ -366,6 +366,48 @@ class ArtworkService {
}
}
/**
* 获取相关推荐作品
*/
async getRelatedArtworks(artworkId, options = {}) {
try {
const { offset = 0, limit = 30 } = options;
if (!artworkId || isNaN(parseInt(artworkId))) {
return {
success: false,
error: 'Invalid artwork ID'
};
}
const params = {
illust_id: parseInt(artworkId),
offset: parseInt(offset),
filter: 'for_ios'
};
const response = await this.makeRequest('GET', '/v2/illust/related', params);
return {
success: true,
data: {
artworks: response.illusts || [],
next_url: response.next_url,
total: response.illusts ? response.illusts.length : 0,
source_artwork_id: artworkId
}
};
} catch (error) {
logger.error('Get related artworks error:', error.message);
logger.error('Get related artworks error details:', error.response?.data);
return {
success: false,
error: error.message || 'Failed to get related artworks'
};
}
}
/**
* 发送API请求
*/