proxyTable: {
'/': {
target: 'https://c.y.qq.com/',
secure: false,
changeOrigin: true,
pathRewrite:{
'^/api' : '/'
},
headers: {
referer: 'https://c.y.qq.com'
}
}
}
recommend.js中
export function getDiscList() {
const url = '/api/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg'
const data = Object.assign({}, commonParams, {
platform: 'yqq',
hostUin: 0,
sin: 0,
ein: 29,
sortId: 5,
needNewCode: 0,
categoryId: 10000000,
rnd: Math.random(),
format: 'json'
})
return axios.get(url, {
params: data
}).then((res) => {
return Promise.resolve(res.data)
}).catch((error) => {
console.log(error)
})
}
2)node
进入build==>webpack.dev.conf.js
const express = require('express')
const axios = require('axios')
const app = express()
var apiRoutes = express.Router()
app.use('/api', apiRoutes)
before(app) {
app.get('/api/getDiscList', function (req, res) {
var url = 'https://c.y.qq.com/splcloud/fcgi-bin/fcg_get_diss_by_tag.fcg'
axios.get(url, {
headers: {
// referer: 'https://y.qq.com/portal/playlist.html'
referer: 'https://y.qq.com/',
host: 'c.y.qq.com'
},
params: req.query
}).then((response) => {
res.json(response.data)
}).catch((e) => {
console.log(e)
})
})
},
export function getDiscList () {
const url = '/api/getDiscList'
const data = Object.assign({}, commonParams, {
rnd: Math.random(),
picmid: 1,
loginUin: 0,
hostUin: 0,
notice: 0,
platform: 'yqq',
needNewCode: 0,
categoryId: 10000000,
sortId: 5,
sin: 0,
ein: 29,
format: 'json'
})
return axios.get(url, {
params: data
}).then((res) => {
return Promise.resolve(res.data)
})
}