提交 becd1d8c authored 作者: zyx's avatar zyx

update

上级 0cc55a81
......@@ -4,28 +4,11 @@ const com = require('@god/node-com')
const Proxy = com.Proxy
const get = (req, res) => {
const use = (req, res) => {
Proxy.reqHttps({
hostname: 'zws-api2.ezijing.com',
path: req.path,
data: {},
query: {},
headers: {
'Host': 'zws-api2.ezijing.com',
'Cookie': req.headers.cookie || '',
'User-Agent': req.headers['user-agent'],
'Content-Type': 'application/x-www-form-urlencoded'
}
}, function (str, cookieStr) {
console.error('接口读取数据', req.headers.token, str)
res.status(200).json(JSON.parse(str))
})
}
const post = (req, res) => {
Proxy.reqHttps({
hostname: 'zws-api2.ezijing.com',
path: req.path,
methods: 'POST',
path: req.originalUrl,
method: req.method,
data: {},
query: {},
headers: {
......@@ -35,12 +18,12 @@ const post = (req, res) => {
'Content-Type': 'application/x-www-form-urlencoded'
}
}, function (str, cookieStr) {
console.error('获取cookie - 123456789', req.headers.cookie)
console.error('接口读取数据', req.headers.token, str)
res.status(200).json(JSON.parse(str))
})
}
module.exports = {
get: get,
post: post
use: use
}
......@@ -58,8 +58,7 @@ router.post('/set/cloud-class', _sccm.setTable)
// 学习系统获取 - 视频课程列表 - 接口转发
router.get('/abc/test/cba/*', _nts.getData)
// 接口转发 - 解决跨域问题
router.get('/v1/pay/wechat/*', _pr.get)
router.post('/v1/pay/wechat/*', _pr.post)
router.use('/v1/pay/wechat/*', _pr.use)
router.use('/api/*', upload.any(), (req, res) => { res.send('暂无该接口') })
router.use('*', upload.any(), (req, res) => { res.send('接口未定义') })
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论