libraries/douban.js
(完整代码) 870Bconst API_URL = 'https://api.douban.com/v2/movie'
function fetchApi (type, params) {
return new Promise((resolve, reject) => {
wx.request({
url: `${API_URL}/${type}`,
data: Object.assign({}, params),
header: { 'Content-Type': 'application/json' },
success: resolve,
fail: reject
})
})
}
module.exports = {
find (type, page = 1, count = 20, search = '') {
const params = { start: (page - 1) * count, count: count }
return fetchApi(type, search ? Object.assign(params, { q: search }) : params)
.then(res => res.data)
},
findOne (id) {
return fetchApi('subject/' + id)
.then(res => res.data)
}
}
// class Douban {
// // 不支持
// // static API_URL = 'https://api.douban.com/v2/movie/'
// constructor (title, movies) {
// this.title = title
// this.movies = movies
// }
// }
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。