From aa418cd0d7c91019100eaba3b99caa830d6c517b Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 23:53:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BA=91=E7=9B=98=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- netease_api/module/artist_fans.js | 15 ++++++++++++ netease_api/module/cloud_match.js | 20 ++++++++++++++++ netease_api/module/digitalAlbum_detail.js | 18 +++++++++++++++ netease_api/module/digitalAlbum_sales.js | 18 +++++++++++++++ netease_api/module/homepage_block_page.js | 2 +- netease_api/module/homepage_dragon_ball.js | 3 --- netease_api/module/listen_together_status.js | 15 ++++++++++++ netease_api/module/login_cellphone.js | 8 ++++--- netease_api/module/mlog_music_rcmd.js | 23 +++++++++++++++++++ netease_api/module/mlog_to_video.js | 18 +++++++++++++++ netease_api/module/mlog_url.js | 15 ++++++++++++ netease_api/module/musician_cloudbean.js | 11 +++++++++ .../module/musician_cloudbean_obtain.js | 19 +++++++++++++++ netease_api/module/musician_data_overview.js | 16 +++++++++++++ netease_api/module/musician_play_trend.js | 19 +++++++++++++++ netease_api/module/musician_sign.js | 16 +++++++++++++ netease_api/module/musician_tasks.js | 16 +++++++++++++ netease_api/module/personalized_newsong.js | 3 ++- netease_api/module/playlist_privacy.js | 20 ++++++++++++++++ netease_api/module/related_playlist.js | 3 ++- netease_api/module/simi_artist.js | 3 --- netease_api/module/song_detail.js | 2 +- netease_api/module/song_purchased.js | 19 +++++++++++++++ netease_api/module/song_url.js | 4 ---- netease_api/module/user_comment_history.js | 22 ++++++++++++++++++ netease_api/module/vip_growthpoint.js | 16 +++++++++++++ netease_api/module/vip_growthpoint_details.js | 19 +++++++++++++++ netease_api/module/vip_growthpoint_get.js | 18 +++++++++++++++ netease_api/module/vip_info.js | 15 ++++++++++++ netease_api/module/vip_tasks.js | 16 +++++++++++++ netease_api/module/yunbei_rcmd_song.js | 21 +++++++++++++++++ .../module/yunbei_rcmd_song_history.js | 21 +++++++++++++++++ netease_api/plugins/songUpload.js | 7 ++++-- src/api/user.js | 3 +++ 34 files changed, 445 insertions(+), 19 deletions(-) create mode 100644 netease_api/module/artist_fans.js create mode 100644 netease_api/module/cloud_match.js create mode 100644 netease_api/module/digitalAlbum_detail.js create mode 100644 netease_api/module/digitalAlbum_sales.js create mode 100644 netease_api/module/listen_together_status.js create mode 100644 netease_api/module/mlog_music_rcmd.js create mode 100644 netease_api/module/mlog_to_video.js create mode 100644 netease_api/module/mlog_url.js create mode 100644 netease_api/module/musician_cloudbean.js create mode 100644 netease_api/module/musician_cloudbean_obtain.js create mode 100644 netease_api/module/musician_data_overview.js create mode 100644 netease_api/module/musician_play_trend.js create mode 100644 netease_api/module/musician_sign.js create mode 100644 netease_api/module/musician_tasks.js create mode 100644 netease_api/module/playlist_privacy.js create mode 100644 netease_api/module/song_purchased.js create mode 100644 netease_api/module/user_comment_history.js create mode 100644 netease_api/module/vip_growthpoint.js create mode 100644 netease_api/module/vip_growthpoint_details.js create mode 100644 netease_api/module/vip_growthpoint_get.js create mode 100644 netease_api/module/vip_info.js create mode 100644 netease_api/module/vip_tasks.js create mode 100644 netease_api/module/yunbei_rcmd_song.js create mode 100644 netease_api/module/yunbei_rcmd_song_history.js diff --git a/netease_api/module/artist_fans.js b/netease_api/module/artist_fans.js new file mode 100644 index 0000000..700eac0 --- /dev/null +++ b/netease_api/module/artist_fans.js @@ -0,0 +1,15 @@ +// 歌手粉丝 + +module.exports = (query, request) => { + const data = { + id: query.id, + limit: query.limit || 20, + offset: query.offset || 0, + } + return request('POST', `https://music.163.com/weapi/artist/fans/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/netease_api/module/cloud_match.js b/netease_api/module/cloud_match.js new file mode 100644 index 0000000..d28d88b --- /dev/null +++ b/netease_api/module/cloud_match.js @@ -0,0 +1,20 @@ +module.exports = (query, request) => { + query.cookie.os = 'ios' + query.cookie.appver = '8.1.20' + const data = { + userId: query.uid, + songId: query.sid, + adjustSongId: query.asid, + } + return request( + 'POST', + `https://music.163.com/api/cloud/user/song/match`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/digitalAlbum_detail.js b/netease_api/module/digitalAlbum_detail.js new file mode 100644 index 0000000..a3ed02d --- /dev/null +++ b/netease_api/module/digitalAlbum_detail.js @@ -0,0 +1,18 @@ +// 数字专辑详情 + +module.exports = (query, request) => { + const data = { + id: query.id, + } + return request( + 'POST', + `https://music.163.com/weapi/vipmall/albumproduct/detail`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/digitalAlbum_sales.js b/netease_api/module/digitalAlbum_sales.js new file mode 100644 index 0000000..89da320 --- /dev/null +++ b/netease_api/module/digitalAlbum_sales.js @@ -0,0 +1,18 @@ +// 数字专辑销量 + +module.exports = (query, request) => { + const data = { + albumIds: query.ids, + } + return request( + 'POST', + `https://music.163.com/weapi/vipmall/albumproduct/album/query/sales`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/homepage_block_page.js b/netease_api/module/homepage_block_page.js index 618e534..af4b074 100644 --- a/netease_api/module/homepage_block_page.js +++ b/netease_api/module/homepage_block_page.js @@ -4,7 +4,7 @@ module.exports = (query, request) => { query.cookie.os = 'ios' query.cookie.appver = '8.1.20' - const data = { refresh: query.refresh || true } + const data = { refresh: query.refresh || false, cursor: query.cursor } return request( 'POST', `https://music.163.com/api/homepage/block/page`, diff --git a/netease_api/module/homepage_dragon_ball.js b/netease_api/module/homepage_dragon_ball.js index 76973aa..00231dd 100644 --- a/netease_api/module/homepage_dragon_ball.js +++ b/netease_api/module/homepage_dragon_ball.js @@ -4,9 +4,6 @@ // !需要登录或者匿名登录,非登录返回 [] const config = require('../util/config.json') module.exports = (query, request) => { - if (typeof query.cookie === 'string') { - query.cookie = cookieToJson(query.cookie) - } if (!('MUSIC_U' in query.cookie)) query.cookie.MUSIC_A = config.anonymous_token const data = {} diff --git a/netease_api/module/listen_together_status.js b/netease_api/module/listen_together_status.js new file mode 100644 index 0000000..61fd902 --- /dev/null +++ b/netease_api/module/listen_together_status.js @@ -0,0 +1,15 @@ +// 一起听状态 + +module.exports = (query, request) => { + return request( + 'POST', + `https://music.163.com/api/listen/together/status/get`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/login_cellphone.js b/netease_api/module/login_cellphone.js index 0d2e7ae..a66b592 100644 --- a/netease_api/module/login_cellphone.js +++ b/netease_api/module/login_cellphone.js @@ -7,9 +7,11 @@ module.exports = async (query, request) => { const data = { phone: query.phone, countrycode: query.countrycode || '86', - password: - query.md5_password || - crypto.createHash('md5').update(query.password).digest('hex'), + captcha: query.captcha, + [query.captcha ? 'captcha' : 'password']: query.captcha + ? query.captcha + : query.md5_password || + crypto.createHash('md5').update(query.password).digest('hex'), rememberLogin: 'true', } let result = await request( diff --git a/netease_api/module/mlog_music_rcmd.js b/netease_api/module/mlog_music_rcmd.js new file mode 100644 index 0000000..a4e00bb --- /dev/null +++ b/netease_api/module/mlog_music_rcmd.js @@ -0,0 +1,23 @@ +// 歌曲相关视频 + +module.exports = (query, request) => { + const data = { + id: query.mvid || 0, + type: 2, + rcmdType: 20, + limit: query.limit || 10, + extInfo: JSON.stringify({ songId: query.songid }), + } + return request( + 'POST', + `https://interface.music.163.com/eapi/mlog/rcmd/feed/list`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + url: '/api/mlog/rcmd/feed/list', + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/mlog_to_video.js b/netease_api/module/mlog_to_video.js new file mode 100644 index 0000000..54b279e --- /dev/null +++ b/netease_api/module/mlog_to_video.js @@ -0,0 +1,18 @@ +// 将mlog id转为video id + +module.exports = (query, request) => { + const data = { + mlogId: query.id, + } + return request( + 'POST', + `https://music.163.com/weapi/mlog/video/convert/id`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/mlog_url.js b/netease_api/module/mlog_url.js new file mode 100644 index 0000000..f7223e0 --- /dev/null +++ b/netease_api/module/mlog_url.js @@ -0,0 +1,15 @@ +// mlog链接 + +module.exports = (query, request) => { + const data = { + id: query.id, + resolution: query.res || 1080, + type: 1, + } + return request('POST', `https://music.163.com/weapi/mlog/detail/v1`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/netease_api/module/musician_cloudbean.js b/netease_api/module/musician_cloudbean.js new file mode 100644 index 0000000..e85a285 --- /dev/null +++ b/netease_api/module/musician_cloudbean.js @@ -0,0 +1,11 @@ +// 账号云豆数 + +module.exports = (query, request) => { + const data = {} + return request('POST', `https://music.163.com/weapi/cloudbean/get`, data, { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }) +} diff --git a/netease_api/module/musician_cloudbean_obtain.js b/netease_api/module/musician_cloudbean_obtain.js new file mode 100644 index 0000000..2320278 --- /dev/null +++ b/netease_api/module/musician_cloudbean_obtain.js @@ -0,0 +1,19 @@ +// 领取云豆 + +module.exports = (query, request) => { + const data = { + userMissionId: query.id, + period: query.period, + } + return request( + 'POST', + `https://music.163.com/weapi/nmusician/workbench/mission/reward/obtain/new`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_data_overview.js b/netease_api/module/musician_data_overview.js new file mode 100644 index 0000000..b96d03e --- /dev/null +++ b/netease_api/module/musician_data_overview.js @@ -0,0 +1,16 @@ +// 音乐人数据概况 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/creator/musician/statistic/data/overview/get`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_play_trend.js b/netease_api/module/musician_play_trend.js new file mode 100644 index 0000000..d8f14fe --- /dev/null +++ b/netease_api/module/musician_play_trend.js @@ -0,0 +1,19 @@ +// 音乐人歌曲播放趋势 + +module.exports = (query, request) => { + const data = { + startTime: query.startTime, + endTime: query.endTime, + } + return request( + 'POST', + `https://music.163.com/weapi/creator/musician/play/count/statistic/data/trend/get`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_sign.js b/netease_api/module/musician_sign.js new file mode 100644 index 0000000..6d5717a --- /dev/null +++ b/netease_api/module/musician_sign.js @@ -0,0 +1,16 @@ +// 音乐人签到 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/creator/user/access`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/musician_tasks.js b/netease_api/module/musician_tasks.js new file mode 100644 index 0000000..cb98c93 --- /dev/null +++ b/netease_api/module/musician_tasks.js @@ -0,0 +1,16 @@ +// 获取音乐人任务 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/nmusician/workbench/mission/cycle/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/personalized_newsong.js b/netease_api/module/personalized_newsong.js index 283b92a..2af12a3 100644 --- a/netease_api/module/personalized_newsong.js +++ b/netease_api/module/personalized_newsong.js @@ -1,6 +1,7 @@ // 推荐新歌 module.exports = (query, request) => { + query.cookie.os = 'pc' const data = { type: 'recommend', limit: query.limit || 10, @@ -8,7 +9,7 @@ module.exports = (query, request) => { } return request( 'POST', - `https://music.163.com/weapi/personalized/newsong`, + `https://music.163.com/api/personalized/newsong`, data, { crypto: 'weapi', diff --git a/netease_api/module/playlist_privacy.js b/netease_api/module/playlist_privacy.js new file mode 100644 index 0000000..ded2819 --- /dev/null +++ b/netease_api/module/playlist_privacy.js @@ -0,0 +1,20 @@ +// 公开隐私歌单 + +module.exports = (query, request) => { + const data = { + id: query.id, + privacy: 0, + } + return request( + 'POST', + `https://interface.music.163.com/eapi/playlist/update/privacy`, + data, + { + crypto: 'eapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + url: '/api/playlist/update/privacy', + }, + ) +} diff --git a/netease_api/module/related_playlist.js b/netease_api/module/related_playlist.js index 6f64b3d..02e580f 100644 --- a/netease_api/module/related_playlist.js +++ b/netease_api/module/related_playlist.js @@ -13,7 +13,8 @@ module.exports = (query, request) => { }, ).then((response) => { try { - const pattern = /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g + const pattern = + /
[\s\S]*?[\s\S]*?]*>([^<]+?)<\/a>[\s\S]*?]*>([^<]+?)<\/a>/g let result, playlists = [] while ((result = pattern.exec(response.body)) != null) { diff --git a/netease_api/module/simi_artist.js b/netease_api/module/simi_artist.js index effef6b..36d2572 100644 --- a/netease_api/module/simi_artist.js +++ b/netease_api/module/simi_artist.js @@ -1,9 +1,6 @@ // 相似歌手 const config = require('../util/config.json') module.exports = (query, request) => { - if (typeof query.cookie === 'string') { - query.cookie = cookieToJson(query.cookie) - } if (!('MUSIC_U' in query.cookie)) query.cookie.MUSIC_A = config.anonymous_token const data = { diff --git a/netease_api/module/song_detail.js b/netease_api/module/song_detail.js index 172b34c..338fddc 100644 --- a/netease_api/module/song_detail.js +++ b/netease_api/module/song_detail.js @@ -5,7 +5,7 @@ module.exports = (query, request) => { const data = { c: '[' + query.ids.map((id) => '{"id":' + id + '}').join(',') + ']', } - return request('POST', `https://music.163.com/weapi/v3/song/detail`, data, { + return request('POST', `https://music.163.com/api/v3/song/detail`, data, { crypto: 'weapi', cookie: query.cookie, proxy: query.proxy, diff --git a/netease_api/module/song_purchased.js b/netease_api/module/song_purchased.js new file mode 100644 index 0000000..c86dfa1 --- /dev/null +++ b/netease_api/module/song_purchased.js @@ -0,0 +1,19 @@ +// 已购单曲 + +module.exports = (query, request) => { + const data = { + limit: query.limit || 20, + offset: query.offset || 0, + } + return request( + 'POST', + `https://music.163.com/weapi/single/mybought/song/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/song_url.js b/netease_api/module/song_url.js index 49b5ed7..46e6bf1 100644 --- a/netease_api/module/song_url.js +++ b/netease_api/module/song_url.js @@ -1,11 +1,7 @@ // 歌曲链接 const crypto = require('crypto') -const { cookieToJson } = require('../util/index') module.exports = (query, request) => { - if (typeof query.cookie === 'string') { - query.cookie = cookieToJson(query.cookie) - } if (!('MUSIC_U' in query.cookie)) query.cookie._ntes_nuid = crypto.randomBytes(16).toString('hex') query.cookie.os = 'pc' diff --git a/netease_api/module/user_comment_history.js b/netease_api/module/user_comment_history.js new file mode 100644 index 0000000..bb98221 --- /dev/null +++ b/netease_api/module/user_comment_history.js @@ -0,0 +1,22 @@ +module.exports = (query, request) => { + query.cookie.os = 'ios' + query.cookie.appver = '8.1.20' + const data = { + compose_reminder: 'true', + compose_hot_comment: 'true', + limit: query.limit || 10, + user_id: query.uid, + time: query.time || 0, + } + return request( + 'POST', + `https://music.163.com/api/comment/user/comment/history`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_growthpoint.js b/netease_api/module/vip_growthpoint.js new file mode 100644 index 0000000..e035c5a --- /dev/null +++ b/netease_api/module/vip_growthpoint.js @@ -0,0 +1,16 @@ +// 会员成长值 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/growhpoint/basic`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_growthpoint_details.js b/netease_api/module/vip_growthpoint_details.js new file mode 100644 index 0000000..be9c927 --- /dev/null +++ b/netease_api/module/vip_growthpoint_details.js @@ -0,0 +1,19 @@ +// 会员成长值领取记录 + +module.exports = (query, request) => { + const data = { + limit: query.limit || 20, + offset: query.offset || 0, + } + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/growth/details`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_growthpoint_get.js b/netease_api/module/vip_growthpoint_get.js new file mode 100644 index 0000000..69ae94b --- /dev/null +++ b/netease_api/module/vip_growthpoint_get.js @@ -0,0 +1,18 @@ +// 领取会员成长值 + +module.exports = (query, request) => { + const data = { + taskIds: query.ids, + } + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/task/reward/get`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_info.js b/netease_api/module/vip_info.js new file mode 100644 index 0000000..30cba78 --- /dev/null +++ b/netease_api/module/vip_info.js @@ -0,0 +1,15 @@ +// 获取 VIP 信息 + +module.exports = (query, request) => { + return request( + 'POST', + `https://music.163.com/weapi/music-vip-membership/front/vip/info`, + {}, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/vip_tasks.js b/netease_api/module/vip_tasks.js new file mode 100644 index 0000000..256e67a --- /dev/null +++ b/netease_api/module/vip_tasks.js @@ -0,0 +1,16 @@ +// 会员任务 + +module.exports = (query, request) => { + const data = {} + return request( + 'POST', + `https://music.163.com/weapi/vipnewcenter/app/level/task/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/yunbei_rcmd_song.js b/netease_api/module/yunbei_rcmd_song.js new file mode 100644 index 0000000..94ddeaa --- /dev/null +++ b/netease_api/module/yunbei_rcmd_song.js @@ -0,0 +1,21 @@ +// 云贝推歌 + +module.exports = (query, request) => { + const data = { + songId: query.id, + reason: query.reason || '好歌献给你', + scene: '', + fromUserId: -1, + } + return request( + 'POST', + `https://music.163.com/weapi/yunbei/rcmd/song/submit`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/module/yunbei_rcmd_song_history.js b/netease_api/module/yunbei_rcmd_song_history.js new file mode 100644 index 0000000..224a4f8 --- /dev/null +++ b/netease_api/module/yunbei_rcmd_song_history.js @@ -0,0 +1,21 @@ +// 云贝推歌历史记录 + +module.exports = (query, request) => { + const data = { + page: JSON.stringify({ + size: query.size || 20, + cursor: query.cursor || '', + }), + } + return request( + 'POST', + `https://music.163.com/weapi/yunbei/rcmd/song/history/list`, + data, + { + crypto: 'weapi', + cookie: query.cookie, + proxy: query.proxy, + realIP: query.realIP, + }, + ) +} diff --git a/netease_api/plugins/songUpload.js b/netease_api/plugins/songUpload.js index c5c85f3..89d85fc 100644 --- a/netease_api/plugins/songUpload.js +++ b/netease_api/plugins/songUpload.js @@ -5,7 +5,7 @@ module.exports = async (query, request) => { 'POST', `https://music.163.com/weapi/nos/token/alloc`, { - bucket: '', + bucket: 'jd-musicrep-privatecloud-audio-public', ext: 'mp3', filename: query.songFile.name.replace('.mp3', ''), local: false, @@ -21,7 +21,7 @@ module.exports = async (query, request) => { try { await axios({ method: 'post', - url: `http://45.127.129.8/ymusic/${objectKey}?offset=0&complete=true&version=1.0`, + url: `http://45.127.129.8/jd-musicrep-privatecloud-audio-public/${objectKey}?offset=0&complete=true&version=1.0`, headers: { 'x-nos-token': tokenRes.body.result.token, 'Content-MD5': query.songFile.md5, @@ -29,9 +29,12 @@ module.exports = async (query, request) => { 'Content-Length': String(query.songFile.size), }, data: query.songFile.data, + maxContentLength: Infinity, + maxBodyLength: Infinity, }) } catch (error) { console.log('error', error.response) + throw error.response } return { ...tokenRes, diff --git a/src/api/user.js b/src/api/user.js index 5caa95a..8269297 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -150,6 +150,9 @@ export function uploadSong(file) { headers: { 'Content-Type': 'multipart/form-data', }, + timeout: 200000, + }).catch(error => { + alert(`上传失败,Error: ${error}`); }); }