新增咪咕源搜索、歌单、排行榜

This commit is contained in:
lyswhut
2019-10-07 21:51:16 +08:00
parent ed12aac7d8
commit f7546b0090
14 changed files with 569 additions and 4 deletions
+20
View File
@@ -0,0 +1,20 @@
import { httpFetch } from '../../request'
import { requestMsg } from '../../message'
import { headers, timeout } from '../options'
const api_test = {
getMusicUrl(songInfo, type) {
const requestObj = httpFetch(`http://ts.tempmusic.tk/url/mg/${songInfo.copyrightId}/${type}`, {
method: 'get',
timeout,
headers,
family: 4,
})
requestObj.promise = requestObj.promise.then(({ body }) => {
return body.code === 0 ? Promise.resolve({ type, url: encodeURI(body.data) }) : Promise.reject(new Error(requestMsg.fail))
})
return requestObj
},
}
export default api_test